开发者

MSBuild Extension Pack Zip the folders and subfolders

I have to Zip my folders and subfolders Using MSbuild, I was looking at the MSBuild Extension pack, and tried this

 <ItemGroup>
  <ZipFiles Include="\Test\Web\**\*.*" >
    <Group>Release</Group>
  </ZipFiles>
 </ItemGroup>



 <MSBuild.ExtensionPack.Compression.Zip TaskAction="Create" CompressFiles="@(ZipFiles)" ZipFileName="$(WorkingDir)%(ZipFiles.Group).zip"/>

开发者_如何学CWhen I do this it just keep adding all the files to root, instead of adding it into the specific subfolder within the zip file.

I am missing something, can anyone help here please.


You need to provide a RemoveRoot property, this property sets the root to remove from the compress files path. (More info)

<ItemGroup>
  <ZipFiles Include="\Test\Web\**\*.*" >
    <Group>Release</Group>
  </ZipFiles>
</ItemGroup>

<MSBuild.ExtensionPack.Compression.Zip 
                        TaskAction="Create" 
                        CompressFiles="@(ZipFiles)" 
                        ZipFileName="$(WorkingDir)%(ZipFiles.Group).zip"
                        RemoveRoot="\Test\Web"/>


I believe you need to have a value for the RemoveRoot property.


Since, nobody answered early, I went ahead and used 7 Zip, Command line utility, to do that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜