Use nant to build a custom nant task

nant

I'm using nant to build our product and have written a custom task to notify our helpdesk system that a new build is available.

I've used nant to build the custom task and also to copy the custom nant task assembly into the nant folder so it's loaded automatically.

Worked fine the first time I ran the build.

The second time I ran the build the copy task failed because nant has loaded the custom task assembly and locked the file. Grrr.

How can I get this to work?

Best Solution

You don't need to copy the assembly to the NAnt folder, just place the following at the top of your build script:

<loadtasks assembly="path\to\MyAssembly.dll" />