· Chris Hammond
Last Updated

Packaging your DotNetNuke Module using NANT

Learn how to use NANT scripts to streamline packaging DotNetNuke Modules with ease. Save time by creating ZIP files with a single command.

Learn how to use NANT scripts to streamline packaging DotNetNuke Modules with ease. Save time by creating ZIP files with a single command.

A few years back I was enlightened by Chris Paterra in the ways of using NANT scripts to aid in the packaging of DotNetNuke Modules. Using NANT to package your WAP (web application project) modules within Visual Studio 2005 is a snap, and can save you a LOT of time each time you have to come up with a new release.

Using NANT scripts we are able to create the Private Assembly Installation ZIP file and Source files for our modules by running a single command from the Command line. With our Publish module this process takes about 23 seconds on average, for our smaller modules the process takes less than 2-3 seconds.

Getting Started with NANT

To get started with using NANT scripts in your own development environment you need to download the latest (0.85) release from SourceForge, you can visit the project page at:

https://sourceforge.net/projects/nant/

Once you’ve installed NANT on your machine (I install it on my C drive in a c:\nant\ folder) you’ll need to add NANT to your system variables path so you can call it from the command line.

Adding NANT to System Variables Path

  1. Right click on My Computer and choose Properties.
  2. Go to the Advanced Tab.
  3. Find the System Variables section and modify the Path variable.
  4. Add your NANT folder (c:\nant\) to the path, separating entries with a semicolon (;).
  5. Save the settings.

Setting Up Your Build File

Now I’d recommend adding a .BUILD file to your DNN Module’s project/solution. The provided sample file is a good start for your project, by opening up the file in VS2005 you’ll see it is an XML document with some basic information about the product name and folder location.

You’ll want to find the references to Engage and EngageF3 in the BUILD file and replace them with the name of your module and business name. You can also play around with the include/exclude options in the Fileset node to add or remove certain types of files from your packages. You’ll see the two sections in the build file that define which ZIP files to create:

  • CreateBinZip: Defines the installation ZIP.
  • CreateSrcZip: Defines the source code ZIP.

Preparing Your DotNetNuke Module

Before running the script, ensure the following:

  1. In the .DNN File:

    • Set your module version properly.
    • Include the necessary SQLDATAPROVIDER files.
    • Include the required DLLs.
  2. In the AssemblyInfo.vb (or .cs for C# projects):

    • Set up your DLL information.
    • Set the version information.

By setting the version number in the assemblyinfo and .dnn file, you can get NANT to include the version number in the package’s file name, allowing an easy way to handle upgrades from version to version for your modules.

Running the NANT Script

Once you have all of the files in the solution set up properly, you can run the NANT script.

  1. Open a Command Prompt.
  2. Change directories to your DNN/desktopmodules/ModuleName/ folder.
  3. Type nant and press Enter.
  4. Watch the magic happen.

If everything builds properly, the script will create a Package folder in your module’s folder. Inside of the Package folder, you should find two newly created ZIP files:

  • Install ZIP: For installing the module.
  • Source ZIP: For the source code.

This method saves time and ensures consistency in module packaging. Try it out and streamline your DotNetNuke module deployment process!

Back to Blog

Related Posts

View All Posts »