msbuildtasks
msbuildtasks copied to clipboard
Added RootDirectory option to Zip task
This allows users to specify a common directory for the archive.
How is this different from WorkingDirectory?
This pull request adds a feature which lets you specify a root directory that you want the archived files to be placed within, inside the generated zip file.
Example
User has two files to archive:
<RootDir>C:\Foo</RootDir>
<MyFiles
Include="$(RootDir)\Bar.txt;$(RootDir)\Baz.txt" />
Case 1: Without RootDirectory
<Zip
ZipFileName="Qux.zip"
Files="@(MyFiles)"
WorkingDirectory="$(RootDir)"
ZipLevel="9" />
Generated Zip File
- Qux.zip
- Bar.txt
- Baz.txt
Case 2: With RootDirectory
<Zip
ZipFileName="Qux.zip"
Files="@(MyFiles)"
WorkingDirectory="$(RootDir)"
RootDirectory="MyCustomFolder"
ZipLevel="9" />
Generated Zip File
- Qux.zip
- MyCustomFolder
- Bar.txt
- Baz.txt
- MyCustomFolder
A better name for this option might be "ArchiveFolder" vs "RootDirectory", now that I think about it. What do you think?