8

I use Xorax IncrediBuild to build Visual Studio 2013 (or later) solutions and projects, they're mostly .vcxproj with a bunch of .csproj ones.

It took me a little bit of digging, but I've learned that:

So, in case of Visual Studio projects, there are two modes available:

  • BuildConsole.exe MyProj.vcxproj which uses DevEnv.exe

  • BuildConsole.exe MyProj.vcxproj /usemsbuild which uses MSBuild.exe

I'd like to learn if there are any differences between using the two engines.

I have made some tests and observed that:

  • IncrediBuild "Initializing..." phase takes slightly longer in case of DevEnv.exe.

  • BuildConsole.exe generates different output, obviously.

  • No (or insignificant) difference in build performance.

In case of building individual C/C++ native projects (.vcxproj) as well as whole solutions (.sln), what are advantages and disadvantages of using DevEnv.exe versus MSBuild.exe?

4

2 回答 2

8

** 免责声明:我在 IncrediBuild 工作 **

我们与 Microsoft 一起确定,为了获得与在 Visual Studio 中构建(没有 IncrediBuild)的行为方式相同的构建,应该使用 DevEnv。MSBuild 以与 VS 稍有不同的方式执行构建,无论是在其生成的构建输出中,还是在执行自定义步骤和其他一些小事情时的行为方式上。如果用户希望 IncrediBuild 构建的行为方式与从 Visual Studio 构建时习惯的方式相同,则应使用默认方式(IncrediBuild 执行 DevEnv)。如果用户习惯于使用 MSBuild 执行他的构建,无论是从命令行还是通过 TFS,都应该使用 UseMSBuild 开关。我们希望允许用户根据他们习惯的方式来选择他们希望 IncrediBuild 的工作方式,

附加评论:

  1. 使用 Devenv 时,初始化阶段确实更长,因为 devenv 加载和解析解决方案和 .vcxproj 文件的方式与 msbuild 不同。解决方案的项目越多——这个阶段需要的时间就越长。此阶段完成所花费的时间增加通常会被实际构建时间的速度增加(当同时构建多个项目时)大大抵消。
  2. 强烈建议将 Devenv 用于我们的预测执行功能,由于上述工作方式,使用 MSBuild 无法提供高达 20% 的额外构建加速。
于 2015-07-29T15:19:01.970 回答
2

微软对此非常明确

对于与构建相关的任务,现在建议您使用 MSBuild 而不是 devenv。有关详细信息,请参阅 MSBuild 命令行参考。

Devenv 文档中自 VS2010 以来的注释,这是 VS 的第一个版本,它开始支持使用 MSBuild 构建 C++ 项目,并将默认项目文件扩展名从 .vcproj 更改为 vcxproj。

这种建议的智慧只有在他们没有明确表达的情况下才能被推断出来。如您所见,Denvv.exe 是一个非常繁重的进程,具有许多 DLL 依赖项,需要一段时间才能开始。另一个你可能会担心你现在这样做的方式,最初的指导是使用 Devenv.com 而不是 Devenv.exe。这些依赖项也是麻烦制造者,当 Devenv.exe 在像服务这样的不寻常的运行时环境中运行时,它们往往会阻碍或直接崩溃。来自地狱的示例故事是这个 Q+A,三个答案,没有一个看起来是正确的。还有其他的。

简单的建议是使用推荐的方式。

于 2015-07-27T13:15:21.807 回答