You can easily auto package your modules by making a few changes to the vbproj (or CSPROJ for C#) file for your project. Packaging your module is really just zipping up the correct files. You can do this with MSBuild by using the MS Build Community Tasks extension. Download it and install it from https://github.com/loresoft/msbuildtasks/downloads
. Once you have that installed its a simple case of editing the vbproj file. To do this in Visual Studio:
- The next line
<Import Project="..\..\BuildScripts\ModulePackage.Targets" /> Imports the generic packaging script from the file ModulePackage.Targets. The next line tells MSBuild to execute the packaging after the build is completed.
<Target Name="AfterBuild" DependsOnTargets="DebugProject;PackageModule"></Target>
This line tells MSBuild to execute both the DebugProject and PackageModule tasks, DebugProject is actually in the vbproj file below but the PackageModule task is in the imported build file. The DebugProject task simply copies files to the root website so you can debug. The PackageModule task firstly Imports the MSBuild Commumity tasks so we can use the Zip task and the XmlRead task. This task is only executed when in Release mode.
Then I use XmlRead to read the version of the module out of the .dnn file.
<Output TaskParameter="Value" PropertyName="Version" />
This is then used later to name the package correctly.Note:
If working with a package that contains multiple sub-packages change the xpath to be "dotnetnuke/packages/package1
/@version" which will use the FIRST version number for the package.
Next we find the files we need and copy them to a Package folder. Note that at DNN Corp we use a standard way to arrange our modules so we can use the same script across the modules.
Now that we have all the files in the package folder we use the Zip task to zip all the files up and then create an Install zip file. Lastly we delete any copied or created folders.
The nice thing about doing it this way is you don't need to execute any external program to do your build, you simply switch to Release mode and hit build. The install zip is then created and dropped into the Website/Install/Modules folder ready to install.
ExamplesChristoc's DotNetNuke Module Development Template
For examples on using MSBuild to package modules check out the 00.00.05 release of the module development templates found at http://christoctemplate.codeplex.comMS Build for DotNetNuke module development
This extension forge project automates the task of creating DotNetNuke module PA and Source packs using MS Build. This MS Build tasks will generate DNN manifest files (.dnn files for DNN 5.x), it will process and generate version #'s, all file updates, release notes, clean up and much more. In addition to packaging, all .js and .css are minified before putting them in the Install pack, for optimal performance. The original .js and .css files remain untouched. MS Build for DotNetNuke module development