问题
In Visual Studio there are several "Setup and Deployment" projects, one of these is "CAB Project".
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 ?
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.
回答1:
The MSBuild Extension Pack offers some compression tasks you could use.
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>
回答2:
If I understand what you're after, a quick-and-easy solution might be to write a powershell or Javascript script, or a batch file, that runs as a post-build event.
You'll need a zip library, probably. DotNetZip works.
回答3:
There's a (poorly marketed) feature of DPack, called Solution Backup that will create a zip file of your solution from within visual studio.
It's free and painless to install.
来源:https://stackoverflow.com/questions/4794503/is-there-a-zip-project-in-visual-studio