1
votes

Scripts.xml:

<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>

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 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). Why is msbuild reporting "C:\Windows\Microsoft.NET\Framework\v2.0.50727" when I explicity run C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe?

1

1 Answers

2
votes

Use Yahoo.Yui.Compressor.MsBuildTask.dll version 1.6.0.1

Unfortunaltelly this version is available only via Nuget Library

Details at: http://yuicompressor.codeplex.com/discussions/272802