As part of my build process in MSBuild 4.0, I get the following directory structure:
\OutDir \ProjectA \File1.dll \File2.dll \File3.exe \ProjectB \Subfolder1 File4.html \File5.dll \File6.dll \File7.exe \ProjectC \File8.dll \File9.exe
I want to create one zip file for each \OutDir subfolder. If I do the following:
<ItemGroup> <ZipSource Include="\OutDir\**.*" /> </ItemGroup> <MSBuild.Community.Tasks.Zip Files="@(ZipSource)" ZipFileName="OutDir\%(ZipSource.RecursiveDir)ZippedOutput.zip" WorkingDirectory="OutDir" />
then each subfolder is encrypted recursively, which works fine for ProjectA and ProjectC, but ProjectB ends with two zip files, one from its root level and one of its subfolders.
My other requirement is that the number of projects is unknown in the assembly file, so I cannot just create an ItemGroup and list the projects that I want to archive.
This task would be simple in NAnt through its foreach task, but how can I achieve this in MSBuild, preferably without resorting to user tasks?
source share