Struggling to get the Nant extension to work

Apr 23, 2014 at 4:59 PM

I've got an existing build and deploy script (kicked off by team city for continuous integration) and I wish to use the nant extension to compress javascript and css.

When I explictly use the nant <loadtasks> task with the path to Yahoo.Yui.Compressor.Build.Nant.dll with verbose="true" the output indicates that nant has not found any tasks in the DLL. No errors are shown it just says:
[loadtasks] Scanning assembly "Yahoo.Yui.Compressor.Build.Nant" for extensions.

Trying loadtasks on other DLLs (example NAnt.Contrib.Tasks.dll) shows the methods loaded in the output.

I'm guessing that I've got a mismatch between the version of nant and the YUI dlls - I tried to add this with NuGet, but that associates it with a project in my solution and I only want to use the nant tasks from the build script - the YUI dlls will not be ran from my application code.

Any ideas? Let me know if you need more detail. I've seen quite a few examples for using the MSBuild extensions, but none for nant - all the search results come back with using the exec task to run the java version.

Many thanks,
Apr 24, 2014 at 1:11 AM
Hi Darryl,

thanks for having a look at using YUICompressor.NET :)

I think FreeRanger made the NAnt dll so I'll leave that with him. I've never used NAnt (nor will I) - so I can't offer any real help :(

My first thought was to

1) clone repo.
2) build nant project
3) use that dll

and if that works, then the dll that's up on nuget needs to be fixed.

(i'm assuming you're using the version available on NuGet .. even though u said u can't .. but I'm guessing you nugett'd it, copied it .. then removed the nuget reference or something).
Apr 24, 2014 at 7:54 AM
Edited Apr 24, 2014 at 8:06 AM

There is a nant example included in the source repository - go here: Example/

If you download the entire repository and build the solution, then go to the Nant Example folder and type "nant", it should just work....then compare the file with yours to see where you are different.

Also I have updated the documentation page ( with the sample nant build file)
Apr 24, 2014 at 10:32 AM
Thank you very much for the rapid response. I'll do that now.
Apr 24, 2014 at 10:45 AM
Excellent - using the demo project and build took me straight to the issue - In Windows 7 downloaded DLLs are marked as downloaded from the internet - I had to right click, choose properties, Unblock on each DLL before anything would work. It was a security exceptions from log4net that gave it away.

Thanks again.
Apr 24, 2014 at 11:32 AM
Ah yes, that old chestnut - funnily enough, I downloaded the demo to windows 7 too before I responded, to check that it still worked.
I got the same problem as you did but I resolved it with sysinternals streams.exe:
 streams.exe -s -d *.*
removed the meta data saying the files were downloaded from the internet and all was good in the world again.

Anyway, you're sorted now which is the main thing!