MSBuild : Item Groups on the fly
MSBuild is part of our continuous integration process. Syncing to Subversion’s latest changes is done using the SvnCheckout Task (MSBuild Community Tasks Project). The revision number is then captured.
Subsequent tasks create staging/deployment targets, based on the revision - C:\deployment\389. This approach allows us to quickly review a directory tree and locate releases by revision.
Automation Challenge
MSBuild Item Groups allow wild cards, for example **\*.* tells MSBuild to build a recursive list of all files in all subdirectories. The wrinkle is MSBuild resolves Item Groups when the script is loaded.
Our targets are created during the running of the script. So the directory contents cannot be resolved at load time.
The solution, create Item Groups on the fly with the CreateItem Task.
<CreateItem Include=”$(DistributionFolder)\$(Revision)\**\*.*”>
<Output TaskParameter=”Include” ItemName=”RevisionedDistributionFolderFiles”/>
</CreateItem>
This creates a named Item Group RevisionedDistributionFolderFiles and resolves the target directory structure for use in later tasks.


October 30th, 2006 at 2:42 pm
Doug,
You might want to check our Parabuild for continuous integration It’ll do all the legwork for you: watch for changes in Subversion, do all checkouts/updates, record/present changes etc. This way your MSBuild script will be able to concentrate of essentials (building) rather than on low level continuous integration plumbing.
Hope this helps.