构建在Visual Studio完成后的Zip文件 [英] Zip files after build completes in Visual Studio

查看:124
本文介绍了构建在Visual Studio完成后的Zip文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我需要后,我建立一个解决方案文件来压缩一些文件的要求。

I have a requirement where I need to zip some files after I build a solution file.

这会是一次自动我建立我在Release /调试模式项目实现。

Could this be achieved automatically once I build my project in Release/Debug mode.

推荐答案

我一般不把这样的东西创建zip文件,安装人员的NuGet包等进入我的实际项目。

为什么呢?因为当我把它放在那里,它被执行的每次的我建立在Visual Studio中的项目,例如,当我调试。结果
但是ZIP文件,安装等。当我做了发布时,才需要的,所以我不想等他们每次我按F5在Visual Studio中的时间重新生成。

Usually I don't put stuff like creating zip files, installers, NuGet packages etc. into my actual project.
Why? Because when I put it there, it gets executed each time I'm building the project in Visual Studio, for example when I'm debugging.
But zip files, installers etc. are only needed when I do a release, so I don't want to wait for them to be re-generated each time I press F5 in Visual Studio.

要做出释放,我通常会创建一个执行 MSBuild项目文件<一个批处理文件/ A>,创造一切必要做一个发布。结果
IMO创建ZIP文件属于成MSBuild项目文件中。

To make a release, I usually create a batch file that executes a MSBuild project file, which creates everything that's necessary to make a release.
IMO creating a ZIP file belongs into that MSBuild project file as well.

你可以找到我,你在这两个以前的答案需要的所有信息:

You can find all the information you need in these two previous answers by me:

  • How to create a basic batch file and MSBuild project file
    (the actual question there is about building an installer with WiX, but in the beginning I'm creating a MSBuild project file)
  • How to create a ZIP file with MSBuild Community Tasks

ZIP文件此外,这里是从我的项目之一,这确实一个例子MSBuild项目文件以下内容:

Plus, here's an example MSBuild project file from one of my projects, which does the following:


  • 构建项目

  • 运行单元测试

  • 创建与二进制两个释放文件夹(一个DLL和一个.EXE)

  • 创建两个zip文件,每一个与二进制代码

  • 文件夹的
  • 创建一个包的NuGet为DLL

  • 创建一个的ClickOnce安装程序中的.exe

  • 自动设置的一切
  • build the project
  • run unit tests
  • create two release folders with binaries (one DLL and one .exe)
  • create two zip files, one for each of the folders with binaries
  • create a NuGet package for the DLL
  • create a ClickOnce setup for the .exe
  • automatically set the correct version number for everything

有关这种方法的好处是,我可以做一个发布,其中包括我刚才列举的一切,只需一次点击(运行批处理。文件)结果
。建立这些东西需要一些时间,但因为它不是在Visual Studio解决方案的一部分,它不会每次我在Visual Studio中进行构建的时间运行 - 我只当我执行它真的需要它。

The great thing about this approach is that I can make a release, which includes everything I have just listed, with a single click (running a batch file).
Creating all this stuff takes some time, but as it's not part of the Visual Studio solution, it doesn't run each time I do a build in Visual Studio - I only execute it when I really need it.

这篇关于构建在Visual Studio完成后的Zip文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆