Thursday, August 28, 2014

DNN - Configuring NAnt to package your DotNetNuke Modules


What is NAnt?

NAnt is an open source .NET build tool that can be found by visiting http://nant.sourceforge.net/ You can do a lot of cool things with NAnt and the C# template linked to above utilizes a NAnt build script to package the module with both a SOURCE and an INSTALL package for deployment.

Installing NAnt

The installation of NAnt is pretty straight forward.
1. Download the BINARY ZIP of the 0.90 release of NAnt from http://nant.sourceforge.net

2. Extract the contents of this ZIP file, this will create a local folder with the same file name.
3. Navigate into the extracted folder until you find a BIN folder, navigate into that BIN folder and copy all of the contents of the folder.
4. Go to your C: drive and create a folder called NANT, within this NANT folder paste what you copied in STEP 3.
5. Now that you have the NAnt files placed we can configure Visual Studio to add NAnt to the external tools menu. To do this you will open up Visual Studio, go to the Tools menu and click on External Tools option, that will bring up a window.
6. Click on Add and put the information in for nant, here’s a screenshot of what information you should define. 

Using NAnt to automate your module packaging

Now that you have NAnt setup within Visual Studio, you can simply open the project, and do a build within Visual Studio. You must do a build in VS first, because this creates the DLL that Nant is going to use for assembly name and version info. Once you’ve done the manual build you can then choose the Tools menu in Visual Studio and choose the nant menu item. 

This will cause NAnt to do a release-compile and package your module! When that happens, you should see something similar to the following in your output window.

If you have a “Build Succeeded” message there than you are all set, NAnt has compiled and packaged your module into a folder called package, in the root of your project. You won’t see this folder in Visual Studio, but if you go to the file system, wherever your project is located, you should see the folder.

Hope this helps!


No comments:

Post a Comment