是否有一个“ ZIP项目”?在Visual Studio中? [英] Is there a "ZIP project" in Visual Studio?
问题描述
在Visual Studio中,有几个安装和部署项目,其中一个是 CAB项目。
In Visual Studio there are several "Setup and Deployment" projects, one of these is "CAB Project".
但是我实际上想要一个简单的 ZIP项目,使我能够从我的解决方案中添加一些文件夹+ dll,并将其全部打包为一个zip文件,以便在网络上轻松分发。
But I actually want a simple "ZIP Project" which enables me to add some folders + dll's from my solution and package this all in a zip file for easy distribution on the web.
-
是否有这样的项目类型?
Is there such a project type ?
当我要自己创建此项目时,
我应该使用
来构建它的哪些资源和引用?
When I want to create this by myself, what resources and references should I use to build this ?
编辑 >
@Cheeso
我创建了一个虚拟的类库项目,该项目依赖于所有子项目。
在这个虚拟项目中,我使用了post-build事件,使用7-zip对dll进行压缩。
但是我希望对此有更好的解决方案。
Edit
@Cheeso
I created a dummy 'class library' project which has dependencies on all the sub projects.
In this dummy project I used the post-build event to zip the dll's using 7-zip.
But I was hoping that there was a better solution for this.
推荐答案
MSBuild扩展包提供了一些可以使用的压缩任务。
例如,编辑项目文件,取消注释 AfterBuild目标,并包括打包所需内容的适当压缩任务。
For example, edit your project file, uncommenting the 'AfterBuild' target and including an appropriate compression task that packages up the content you want.
<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>
这篇关于是否有一个“ ZIP项目”?在Visual Studio中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!