One of the big tasks each release is to make sure that the packages we release have all the correct files and no “extra” files. Doing this manually is quite tedious and since i don’t like tedium and i love to automate tasks I developed a method to compare the newly generated packages with the last released package using Beyond Compare. Once I figured it out it was quite a simple solution which I’d like to share so you can look at doing it for your own modules, skins etc. The idea is to compare the contents of the current package zip file with the last released one and generate a report showing the orphan files in both packages. This then makes the task of checking very simple.
Beyond Compare 3 has a cool feature that allows you to write a script file to tell it what to do. Its a simple text file called ComparisonReport.txt as shown below:
load %1 %2
expand all
folder-report layout:summary options:display-orphans output-to:%3 output-options:html-color
%1 is the first folder to compare.
%2 is the second folder to compare.
%3 is the name of the file to save the report into.
What this does is load to folders (zip files work as folders), expands them out and the saves a html file with the list of orphan files. To call this script you need to invoke Beyond Compare in a command window like this:
BCompare.exe ComparisonReport.txt DotNetNuke_Community_5.6.0.xxx_Install.zip DotNetNuke_Community_05.05.01_Install.zip InstallComparison.html /closescript
I wanted this to be even more automated so i added it to the packaging process using Cruise Control.Net as a task like this
<ShellCommand Command="$(BeyondCompare) @$(RootFolder)\Tools\MSBuild\ComparisonReport.txt $(ReleasesFolder)\CE\$(LastReleasedVersion)\DotNetNuke_Community_$(LastReleasedVersion)_Install.zip $(PackagesFolder)\CommunityPackages\$(BuildVersion)\DotNetNuke_Community_$(BuildVersion)_Install.zip $(PackagesFolder)\CommunityPackages\$(BuildVersion)\InstallComparison.html /closescript" WaitCompletion="True" />
Now every time I run the packaging for DotNetNuke I get a nicely formatted HTML report showing any orphan files in either zip file which makes it nice and easy to see if we are missing any files or if files that aren’t needed have accidentally been included in the packages.
Hope you find this useful.