MSBuild Extension Pack提供了一些您可以使用的compression tasks。
例如,編輯您的項目文件,取消註釋'AfterBuild'目標幷包含合適的壓縮任務,以打包所需的內容。
<Project>
...
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
-->
<Target Name="AfterBuild">
<ItemGroup>
<!-- Set the collection of files to Zip-->
<FilesToZip Include="C:\YourContent\*"/>
</ItemGroup>
<MSBuild.ExtensionPack.Compression.DNZip TaskAction="Create" CompressFiles="@(FilesToZip)" ZipFileName="C:\YourZipFile.zip"/>
</Target>
</Project>