Updated to latest YUI.Compressor and getting failures


I tried updating from Yahoo.YUI.COmpressort.dll ( to the latest version of Yahoo.YUI.Compressor.NET (, including the EMCA and Iesi.Collections dependencies, and I'm getting the following error:

errorMSB4062: The "CompressorTask" task could not be loaded from the assembly C:\inetpub\wwwroot\Build\Tools..\Libraries\SharedAssemblies\Yahoo.Yui.Compressor.dll. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Note: I copied these files over the old ones in the same directory, refreshed code, and verified my msbuild file still had the correct references. I've tried several variations of configurations, the most simple of which is below.
<UsingTask TaskName="CompressorTask" AssemblyFile="..\Libraries\SharedAssemblies\YUI\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
  <Target Name="AfterBuild">
      <HomesCss Include="$(ReleasePath)\homes\styles\CalendarPopupStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\CalendarStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\ComboBoxStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\GridStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\MainMenuStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\MainStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\NavigationStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\TabStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\WebPartStyles.css" />
      <HomesCss Include="$(ReleasePath)\homes\styles\FullCalendar.css" />
    <CompressorTask SourceFiles="@(HomesCss)"
                    OutputFile="$(ReleasePath)\homes\styles\Site.css" />

      <MobileiPhoneCss Include="$(ReleasePath)\mobile\styles\iPhone2.css" />
    <CompressorTask SourceFiles="@(MobileiPhoneCss)"

      <PartnerDesktopCss Include="$(ReleasePath)\partner\styles\Desktop.css" />
    <CompressorTask SourceFiles="@(PartnerDesktopCss)"
                    OutputFile="$(ReleasePath)\partner\styles\Desktop.css" />
I'm guessing that something is changed with the newer file and I don't have my configurations set correctly.

Any help would be greatly appreciated.


file attachments

Closed Mar 13, 2013 at 3:41 PM by freeranger


purekrome wrote Mar 13, 2013 at 1:23 PM

can you please tell us
  1. the full path/location where you are running msbuild from?
  2. the command you're typing in the command prompt.

purekrome wrote Mar 13, 2013 at 1:25 PM

oh .. and the full path of: ..\Libraries\SharedAssemblies\YUI\Yahoo.Yui.Compressor.Build.MsBuild.dll

if there's any sensitive data in the path name (like a person's name, company name or project name), just substitute those with fake names.

freeranger wrote Mar 13, 2013 at 1:50 PM

The problem is quite simple - 2.X introduces breaking changes. There is no CompressorTask anymore as it has been split into discrete tasks
Please refer to the documentation: http://yuicompressor.codeplex.com/documentation

zambodi wrote Mar 13, 2013 at 2:27 PM

  1. Path location running from: From: C:\inetpub\wwwroot\Build\Tools\
  2. Command: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe AppsDeploy.msbuild /p:Configuration=Release
  3. C:\inetpub\wwwroot\Build\Libraries\SharedAssemblies\YUI\Yahoo.Yui.Compressor.Build.MsBuild.dll
I've uploaded a PNG of the instructions to which you pointed. It looks like the "name" of the task is "CompressorTask". It looks to me that I have it configured exactly like the documentation. Can you point out what I'm missing in comparison to the uploaded image.. I'm missing it.


zambodi wrote Mar 13, 2013 at 2:37 PM

I removed the complexity of paths and other msbuild activities from my file and run again. This is my exact message:

.exe Test.msbuild /p:Configuration=Debug
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.18034]
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 3/13/2013 9:34:33 AM.
Project "C:\inetpub\wwwroot\Tools\Test.msbuild" on node 1 (default targets).
C:\inetpub\wwwroot\Tools\Test.msbuild(20,5): error MSB4062: The "CompressorTask
" task could not be loaded from the assembly C:\inetpub\wwwroot\Libraries\Share
dAssemblies\YUI\Yahoo.Yui.Compressor.Build.MsBuild.dll. Confirm that the <Usin
gTask> declaration is correct, that the assembly and all its dependencies are a
vailable, and that the task contains a public class that implements Microsoft.B
Done Building Project "C:\inetpub\wwwroot\Tools\Test.msbuild" (default targets)


"C:\inetpub\wwwroot\Tools\Test.msbuild" (default target) (1) ->
(AfterBuild target) ->
C:\inetpub\wwwroot\Tools\Test.msbuild(20,5): error MSB4062: The "CompressorTa
sk" task could not be loaded from the assembly C:\inetpub\wwwroot\Libraries\Sha
redAssemblies\YUI\Yahoo.Yui.Compressor.Build.MsBuild.dll. Confirm that the <Us
ingTask> declaration is correct, that the assembly and all its dependencies are
available, and that the task contains a public class that implements Microsoft
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.03

.exe Test.msbuild /p:Configuration=Debug

purekrome wrote Mar 13, 2013 at 2:38 PM

Have a look at this sample msbuild.prj file: http://yuicompressor.codeplex.com/SourceControl/changeset/view/82550#1331074

notice the top is like this:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">

 <UsingTask TaskName="CssCompressorTask" AssemblyFile="..\..\lib\NET20\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
 <UsingTask TaskName="JavaScriptCompressorTask" AssemblyFile="..\..\lib\NET20\Yahoo.Yui.Compressor.Build.MsBuild.dll" />

where we have a different name for the TaskName.

can you refer to that doc and try some more stuff?

freeranger wrote Mar 13, 2013 at 2:48 PM


You are using a task called "CompressorTask" which, as I said, does not exist any more.
As per the area you highlighted in the image you uploaded, the name of the task is "CssCompressorTask" for css files or ("JavaScriptCompressorTask" for the javascript compressor).

Please use CssCompressorTask and change any property names that have changed also, per the documentation, and you should be good to go.


zambodi wrote Mar 13, 2013 at 3:04 PM

Ah.. I was thinking the name was dynamic. It's already working! Thanks and sorry for the confusion.

freeranger wrote Mar 13, 2013 at 3:41 PM

Glad we could help!

purekrome wrote Mar 13, 2013 at 11:41 PM

group hi-5!