Home > DNN
Showing posts with label DNN. Show all posts

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!


DNN - Error 2 The "MSBuild.Community.Tasks.XmlRead" task could not be loaded...


If you are using Christoc's DotNetNuke Module Development Template, you might run into the error when trying to publish - "Error 2 The "MSBuild.Community.Tasks.XmlRead" task could not be loaded..."

Here are the possible solutions -
  1. Try creating a new project or installing the templates again.
  2. Create a \packages\MSBuildTasks.1.4.0.45\tools\ inside my desktopmodules/myproject and place the  MSBuild.Community.Tasks.dll there...
    Rebuild project and the install folder is there with the package created.
  3. From VS 2012 go to Tools > Library Package Manager > Package Manager Console
    After Package Manager Console loads, type the following command -
    PM> Install-Package MSBuildTasks
    You should get the following messages:
    Successfully installed 'MSBuildTasks 1.4.0.45'.
    Successfully added 'MSBuildTasks 1.4.0.45' to ($CustomModule).
    Delete temporary file
    Copying MSBuild Community Tasks files to ($SolutionDir)\Website\DesktopModules
    ($CustomModule)\Build
    Don't forget to commit the Build folder
    Installing MSBuild Community Tasks Targets file import into project ($CustomModule)
    Import will be added for: $(SolutionDir)\Build\MSBuild.Community.Tasks.targets
    Import added!

    You should now be able to rebuild your module in Release mode. 
1>------ Build started: Project: [projectname], Configuration: Release Any CPU ------
1>CSC : warning CS1607: Assembly generation -- The version '00.00.01.*' specified for the 'file version' is not in the normal 'major.minor.build.revision' format
1>  [projectname] -> [projectpath][projectname].dll
2>------ Publish started: Project: [projectname], Configuration: Release Any CPU ------
2>Connecting to C:\Dev\[projectname]Publish...
2>Copying all files to temporary location below for package/publish:
2>obj\Release\Package\PackageTmp.
2>Publishing folder /...
2>Publishing folder App_LocalResources...
2>Publishing folder bin...
2>Site was published successfully [projectpath][projectname]Publish
2>
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========