Friday, 7 October 2011

Create IIS 7.5 Virtual Directory with Nant Contrib mkiisdir Task

The NAnt core library doesn't include a task to create an IIS virtual directory, but you'll find extra tasks in the nancontrib library. Amongst them is the "mkiisdir" task. Download the nantcontrib library at: http://sourceforge.net/projects/nantcontrib/.

To utilise this library load the "NAnt.Contrib.Tasks.dll" file just before the task to create the virtual directory, like so;

"loadtasks assembly="${nantcontrib.folder}\bin\NAnt.Contrib.Tasks.dll" "

Now invoke the task to create your virtual directory.

"mkiisdir dirpath="${virtual.directory.physical.path}" vdirname="{virtual.directory.name}" "

Test run your script.

Note: If you encounter any permission issues involving the "NAnt.Contrib.Tasks.dll", navigate to the properties pages of this dll and click the unblock button beneath the Advanced section if enabled.

No comments:

Post a Comment