The "CompressorTask" task was not found.

Sep 16, 2011 at 9:31 AM

Using Scripts.xml

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
 
    <UsingTask
        TaskName="CompressorTask"
        AssemblyFile="Yahoo.Yui.Compressor.dll" />

    <PropertyGroup>
        <JavaScriptOutputFile Condition=" '$(JavaScriptOutputFile)'=='' ">..\..\site.com\javascript\offerta.min.js</JavaScriptOutputFile>
    </PropertyGroup>

    <Target Name="ScriptTask">
      <ItemGroup>
        <JavaScriptFiles Include="..\..\site.com\javascript\offerta.js"/>
      </ItemGroup>
      <CompressorTask
           JavaScriptFiles="@(JavaScriptFiles)"
           ObfuscateJavaScript="True"
           PreserveAllSemicolons="True"
           DisableOptimizations="False"
           EncodingType="utf-8"
           DeleteJavaScriptFiles="false"
           LineBreakPosition="-1"
           JavaScriptOutputFile="$(JavaScriptOutputFile)"
           LoggingType="HardcoreBringItOn"
           ThreadCulture="en-us"
           IsEvalIgnored="false" />
    </Target>

</Project>

I run it using a bat file:

C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe Scripts.xml

pause

I'm getting:

"F:\Checkouts\Offerta\trunk\build\site.com\Scripts.xml" (default target) (1)
->
(ScriptTask target) ->
  F:\Checkouts\Offerta\trunk\build\site.com\Scripts.xml(16,7): error MSB4036:
 The "CompressorTask" task was not found. Check the following: 1.) The name of
the task in the project file is the same as the name of the task class. 2.) The
 task class is "public" and implements the Microsoft.Build.Framework.ITask inte
rface. 3.) The task is correctly declared with <UsingTask> in the project file,
 or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v2.
0.50727" directory.

What am I doing wrong? I'm using Yahoo.Yui.Compressor v1.6.0.0.zip (for .NET 3.5)

Coordinator
Sep 16, 2011 at 1:33 PM

two questions.

 

1. What is the path of the file Yahoo.Yui.Compressor.dll ? (eg: c:\foo\pewpew\etc..)

2. Where are you running the command line from? eg. F:\Checkouts\Offerta\trunk\build\site.com\Scripts.xml 
   Is that the location/path?

if so, u need to make sure the  Yahoo.Yui.Compressor.dll can be found/seen by msbuild from the location u run the command. So either copy Yahoo.Yui.Compressor.dll to the same place u run the msbuild.exe command OR update the path in the Scripts.xml file ..

eg.

 <UsingTask
        TaskName="CompressorTask"
        AssemblyFile="F:\Checkouts\Offerta\trunk\build\site.com\packages\yahoo-pew-pew\Yahoo.Yui.Compressor.dll" />

do those ideas help you?

Sep 16, 2011 at 1:59 PM

1. I get the same result if I explicity set the path of the .dll

    <UsingTask
      TaskName="CompressorTask"
      AssemblyFile="F:\Checkouts\Offerta\trunk\build\offerta.se\Yahoo.Yui.Compressor.dll" />

2. I'm running the same directory as the .xml file and the dlls:

F:\Checkouts\Offerta\trunk\build\offerta.se>msbuild Scripts.xml
Microsoft (R) Build-motor version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.237]
Copyright (C) Microsoft Corporation 2007. Med ensamrätt.

Genereringen startade 2011-09-16 15:57:35.
Projektet F:\Checkouts\Offerta\trunk\build\offerta.se\Scripts.xml på nod 1 (sta
ndardmål).
F:\Checkouts\Offerta\trunk\build\offerta.se\Scripts.xml(16,7): error MSB4062: D
et gick inte att läsa in CompressorTask-aktiviteten från sammansättningen F:\Ch
eckouts\Offerta\trunk\build\offerta.se\Yahoo.Yui.Compressor.dll.  Kontrollera a
tt <UsingTask>-deklarationen är korrekt och att sammansättningen och alla dess
beroenden är tillgängliga samt att aktiviteten innehåller en offentlig klass so
m implementerar Microsoft.Build.Framework.ITask.
Projektgenereringen av F:\Checkouts\Offerta\trunk\build\offerta.se\Scripts.xml
(standardmål) misslyckades.

(Sorry msbuild error is in swedish)

Coordinator
Sep 17, 2011 at 4:30 AM

@Nielsbosma : please read this discussion. I've posted a solution and steps, within it. 

Tell me if u have it working again, please :)

Sep 19, 2011 at 8:27 AM
Worked a lot better :)

2011/9/17 purekrome <notifications@codeplex.com>:
> From: purekrome
>
> @Nielsbosma : please read this discussion. I've posted a solution and steps,
> within it.
>
> Tell me if u have it working again, please :)
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe on CodePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at CodePlex.com