Jun
19
Posted by:
Philip Beadle
Thursday, June 19, 2008 12:00 AM
When you build a DNN module using the template or from scratch you probably locate the project under the Desktop modules folder and start developing. Doing this complicates source control and automated building in my experience so I wanted a way to build my modules in a separate folder away from the target host website. Andrew Nurse dropped a snippet of a build script to me that copies the assemblies, pdb files and the rest of the files you need to debug your module on. It copies the files marked as Content in the Build Action.
I also wanted a way to auto package my module ready for the project tracker into zip files for install and source.
So I needed to specify the files I wanted so I used an item group as below:
<ItemGroup>
<ZipSourceFilesInclude="a2z.gif" />
<ZipSourceFilesInclude="App_LocalResources\CategoryEdit.ascx.resx" />
<ZipSourceFilesInclude="App_LocalResources\EditHelp.ascx.resx" />
<ZipSourceFilesInclude="App_LocalResources\Help.ascx.resx" />
<ZipSourceFilesInclude="App_LocalResources\HelpEdit.ascx.resx" />
<ZipSourceFilesInclude="App_LocalResources\NavPane.ascx.resx" />
<ZipSourceFilesInclude="App_LocalResources\Settings.ascx.resx" />
<ZipSourceFilesInclude="App_LocalResources\ViewHelp.ascx.resx" />
Etc
<ZipSourceFilesInclude="CategoryEdit.ascx" />
<ZipSourceFilesInclude="CategoryEdit.ascx.designer.vb" />
<ZipSourceFilesInclude="CategoryEdit.ascx.vb" />
<ZipSourceFiles
<ZipSourceFilesInclude="refresh.gif" />
<ZipSourceFilesInclude="Settings.ascx" />
<ZipSourceFilesInclude="Settings.ascx.designer.vb" />
<ZipSourceFilesInclude="Settings.ascx.vb" />
<ZipSourceFilesInclude="Uninstall.SqlDataProvider" />
<ZipSourceFilesInclude="03.00.02.txt" />
</ItemGroup>
The script below is added to the end of your project file and it copies the files to your host website and then zips them up ready to install.
Enjoy.
<TargetName="AfterBuild"DependsOnTargets="DeployModule">
Target>
<PropertyGroup>
<Major>03Major>
<Minor>00Minor>
<Build>02Build>
PropertyGroup>
<PropertyGroup>
<ProjectName>HelpProjectName>
<ModuleFolder>HelpModuleFolder>
<DNNDirectory>C:\DotNetNuke\Releases\DotNetNuke_04.08.02_InstallDNNDirectory>
<PackageDirectory>C:\DotNetNuke\PackagePackageDirectory>
PropertyGroup>
<TargetName="DeployModule">
<CreateItemInclude="$(MSBuildProjectDirectory)\$(OutputPath)$(AssemblyName).dll">
<OutputTaskParameter="Include"ItemName="ModuleAssemblies" />
CreateItem>
<CreateItemInclude="$(MSBuildProjectDirectory)\$(OutputPath)\*.pdb">
<OutputTaskParameter="Include"ItemName="ModuleDebug" />
CreateItem>
<CopySourceFiles="@(Content)"DestinationFiles="@(Content -> '$(DNNDirectory)\DesktopModules\$(ModuleFolder)\%(Identity)')"SkipUnchangedFiles="true" />
<CopySourceFiles="@(ModuleAssemblies);@(ModuleDebug)"DestinationFolder="$(DNNDirectory)\bin" />
<ZipFiles="@(ZipSourceFiles)"ZipFileName="resources.zip" />
<ZipFiles="@(Content);@(ModuleAssemblies);resources.zip"Flatten="True"ZipFileName="$(ProjectName)_$(Major).$(Minor).$(Build)_Source.zip" />
<ZipFiles="@(Content);@(ModuleAssemblies)"Flatten="True"ZipFileName="$(ProjectName)_$(Major).$(Minor).$(Build)_Install.zip" />
Target>
4 comment(s) so far...
Re: Take your Module Development another step by automating your packaging
Would you please point me the a link with Andrew Nurse's snippet you mentioned here? Thanks Vlado
By Starlogic on
Wednesday, July 16, 2008 9:42 AM
|
Re: Take your Module Development another step by automating your packaging
its on an internal private forum so I cant.
By philip.beadle on
Wednesday, July 16, 2008 9:42 AM
|
Re: Take your Module Development another step by automating your packaging
Do you have issues with references to user controls in ~/controls (e.g. dnn:Label)? I cannot get that to work properly. The reference complains about the path.
By Andrew Galbraith Ryer on
Wednesday, December 22, 2010 4:51 AM
|
Re: Take your Module Development another step by automating your packaging
Hi Andrew, You'll get that issue because the module isnt in a location that can find the controls. It doesnt affect your coding much.
By Philip Beadle on
Wednesday, December 22, 2010 4:53 AM
|