Nant build scripts template for Visual Studio
Published on May 18, 2008I was creating for the 10th time today a nant build file from Visual Studio when I came to the realization that I needed to automate the process a bit more. So I created an item template to include build files. You just need to copy this zip file into the ItemTemplate folder inside your Templates. Usually is My Documents\Visual Studio 2008\Templates\ItemTemplates
After that just right click on a project or solution and select Add New Item, at the bottom of the dialog you will see a section called My Templates.
Notice the new Nant build file item.
Adding intellisense to edit the file
There are a few other post out there to do this on VS 2005 on VS 2008 there are a few changes. The most important one is where to install the schemas.
- Copy the nant.xsd schema file from your Nant folder, inside a subfolder called schema
- Paste the file on the schemas folder for VS 2008; C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas
- Open Visual Studio and use the new item template to create a build file
If you type “<” you will see a list of options
Troubleshooting
If it doesn’t work for you it may be possible that you have a different version of schema files. On VS with the build file open click on Xml → Schemas
Locate the entry for the build file and check the target namespace, it should be the same as the xmlns attribute of your project tag
If it’s not change the attribute value with the value displayed in the schemas dialog.