DotNetNuke is an open source CMS based on Microsoft .Net technology. DotNetNuke can be easily installed and hosted. In general, DotNetNuke framework allows individuals to do whatever they wish with the application framework both commercially and non-commercially, with the simple requirement of giving credit back to the DotNetNuke project community. In this article, I will tell you how to automate the packaging of your DNN Module.
DotNetNuke is a program that runs on Microsoft ASP.NET. It is also a framework, meaning, it is a program that is designed to be extended. One of the ways you extend the framework is to create modules. These modules are installed inside a DotNetNuke installation and when they run in that DotNetNuke installation they extend the framework to create a DotNetNuke website also called a portal.
Here are the steps for automate the packaging of your DNN Module:
- Delete all source code and start over from scratch with my templates installed. If you really don’t want to go through step #1, you can skip it, but you must then go on to Step 2 below
- Open your project in Visual Studio
- Install the MSBuildTasks project from Nuget:
PM> Install-Package MSBuildTasks
- Create a BuildScripts folder in your project
- Right click on the project in Visual Studio Solution Explorer and choose “Unload Project”
- Right click on the unloaded project and choose the Edit option
- At the bottom of the file, before the </Project> section add
<Import Project="BuildScripts\ModulePackage.Targets" />
<Target Name="AfterBuild" DependsOnTargets="PackageModule">
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
- Change the “CHANGEME” text to match the name of your .DNN file and the name of the ZIP file that you want the package created as.
- Save the Project changes.
- Right click on the project in Solution Explorer and choose Reload Project.
- Switch into Release mode in Visual Studio and do a Build of your project.
- This should create two files, ModuleName_Version#_Install.zip and ModuleName_Version#_Source.zip.
What I typically do then is install the module to a test DNN install to make sure that everything is working correctly. You’ll want to make sure that the ZIP files created contain all the right files, and they get installed correctly, so a test installation is the best way to go through that process.
If something fails, try to track it down, then do another Build in Release mode, rinse and repeat the installation process in your test install until you get everything working properly.
Now going forward, after you do a release, you go into your AssemblyInfo file, change your version number there, and into your .DNN File and change your Version number there. Next time you build in Release mode the module will create a new VERSION number ZIP file, leaving your last version builds there as well.