Question

I am using NuGet to pull in YUICompressor.NET.MSBuild, which in turn pulls in YUICompressor.NET and EcmaScript.Net.

It also adds references to all three DLLs in my web project. I can then add the UsingTask reference like this:

<UsingTask TaskName="CssCompressorTask" AssemblyFile="$(SolutionDir)\packages\YUICompressor.NET.MSBuild.2.3.0.0\lib\NET20\Yahoo.Yui.Compressor.Build.MsBuild.dll" />

And then use the task to compress my Javascript/CSS in an AfterBuild target

However, I don't want to have to reference these DLLs in my web project (as they are not actually part of what I ship)... but when I remove the references, then CssCompressorTask can no longer find the other two dependent DLLs (they are in different folders off the /packages folder - it works ok if they are alongside Yahoo.Yui.Compressor.Build.MsBuild.dll)

Believe it or not, I have spent hours trying to get the dependencies to resolve: First I tried to modify AssemblySearchPaths to include all the other /packages subfolders, as here:

https://github.com/BenPhegan/NuGetAutoTransitiveDependencies

This didn't work, so I tried to create an inline assembly resolver, as here:

MSBuild UsingTask Resolve References

This doesn't work either. At the moment, I am thinking the only choice I have is to get the dependent DLLs alongside the UsingTask dll, one way or another... but this feels like my MSBuild foo is failing me :/

Any ideas much appreciated! Thanks.

Was it helpful?

Solution 2

Ok, v2.4.0.0+ now include the DLLs

OTHER TIPS

I needed my custom task to use the JSON API (NewtonSoft). MSBuild did not load the external dll until I ran gacutil /i [path to dll].

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top