Like many people I have been building DotNetNuke Modules using Chris Hammond's DotNetNuke Module Template. It is a great template set and works well in 99.9% of cases. However, recently I have been building more and more complex module solutions for customers where within a single project I have a need to package up two or more "distinct" modules. Therefore I have one DotNetNuke Module Manifest and it will install multiple modules. Overall the process works great, but there is one small nuance, the filename, if you have two modules you will get xx.xx.xx.yy.yy.yy as the filename, which is the version of module 1, and the version of module two. In my case I just want the first module to show, and in this post I'll show you how.
The Modification
Thankfully the change is very simple. Within your "ModulePackage.targets" file that is in the "BuildScripts" folder we need to make one modification. Take the existing "XmlRead" node of the document and replace it with the following.
<XmlRead Prefix="n"
Namespace="http://schemas.microsoft.com/developer/msbuild/2003"
XPath="dotnetnuke/packages/package[1]/@version"
XmlFileName="$(DNNFileName).dnn">
<Output TaskParameter="Value" PropertyName="Version" />
</XmlRead>
If you compare this to the value before you will notice only one small change which is the addition of [1] after the package portion of the XPath. This instructs the process to ONLY read the first package's version attribute, rather than combining the values from all packages.
I hope that this quick tip was helpful to those of you working with more complex module deployment solutions. Feel free to share feedback below.
This post has been cross-posted from my personal blog.