Tools for Authoring NAnt Build Files
Join the DZone community and get the full member experience.
Join For FreeNAnt is a great tool for automating many computer tasks. For a quick introduction, check my previous articles Automating Your Computer Tasks with NAnt and Use NAnt and WinRar to Create a Self Extracting Archive. Authoring NAnt build files can be difficult without a good editor and editing XML is not my favorite thing to do anyway. Having to know all the tags and parameters for each NAnt task, makes it even less desirable. Looking at the current options, you can find several tools for authoring NAnt build files:
- NAntPad - Commercial - http://nantpad.com
- NAntBuilder - Commercial - http://www.nantbuilder.com
- Editor4NAnt - Free - http://www.download.com/Editor4NAnt/3000-2352_4-10531916.html
While the tools above will do the job, it would be nice if you could edit your build files in Visual Studio and have at least the basic intellisense that the IDE provides. It turns out that editing NAnt build files with VS and having code insight is a pretty easy thing to setup. Here is how it is done:
- Install the NAnt schema by copying the file "nant.xsd" form the NAnt distribution to "C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas"
- Associate NAnt build files (.build) with the Visual Studio XML editor. This can be done in one of two ways:
- Create a registry merge file with the following contents and merge it in your registry:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Editors\{412B8852-4F21-413B-9B47-0C9751D3EBFB}\Extensions] "build"=dword:00000029
- Make the association through Visual Studio:
- Open any Visual Studio solution
- Add a NAnt build file to it
- Right click on the .build file and choose "Open With"
- Select "XML Editor" and click on "Set as Default"
- Create a registry merge file with the following contents and merge it in your registry:
- Almost there. The last thing is to add the "xmlns" (namespace) attribute to the "project" tag of your build file. If you have copied the NAnt schema file (nant.xsd) to the right place, adding the "xmlns" attribute should list the NAnt schema as one of the available choices. The end result should look like:
<project name="testProject" default="buildSetup" basedir="." xmlns="http://nant.sf.net/release/0.85/nant.xsd" >
- And Voila! Start typing some XML and you should see a list of NAnt tasks and attributes.
Opinions expressed by DZone contributors are their own.
Trending
-
The SPACE Framework for Developer Productivity
-
How To Use Geo-Partitioning to Comply With Data Regulations and Deliver Low Latency Globally
-
Revolutionizing Algorithmic Trading: The Power of Reinforcement Learning
-
Constructing Real-Time Analytics: Fundamental Components and Architectural Framework — Part 2
Comments