Search code examples
.netvisual-studiomsbuildmsbuild-task

MSBuild Using Take Fails to load assembly


I am attempting to use MSBuild and the YUICompressor for .NET to compress my js and css files upon build.

I am following the documentation found here and here

When I try to build, I am getting the following error:

Error   4   The "CompressorTask" task could not be loaded from the assembly C:\Apps\MyApp\packages\YUICompressor.NET.1.7.0.0\lib\net35\Yahoo.Yui.Compressor.dll.

Confirm that the 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.

My post build command is as such:

$(MSBuildBinPath)\msbuild.exe /p:Configuration=$(ConfigurationName) "$(ProjectDir)MSBuild\MSBuildSettings.xml"

Any ideas on why this may be occuring? The assemblies seem to be in the correct directories.


Solution

  • Solved this... I needed to reference a different dll in the UsingTask setting

     <UsingTask TaskName="CompressorTask" AssemblyFile="Yahoo.Yui.Compressor.MSBuildTask.dll" />
    

    Please see the sample application referenced in the downloads section of http://yuicompressor.codeplex.com/