使用DevEnv.exe进行非并发构建

时间:2014-02-13 16:37:49

标签: visual-studio-2010 build devenv

我需要使用devenv.exe来构建我们的VS2010项目。我需要一次构建1个项目,因为同时运行多个构建会导致问题。我在工具中将并发构建的数量设置为1 - >选项 - >项目&解决方案 - >构建并运行。当我直接从VS2010执行构建时,一切工作都要求预期。

------ Rebuild started: Project: project1, Configuration: Release Win32 ------
.
Compile Output
.
------ Rebuild started: Project: project2, Configuration: Release Win32 ------
.
Compile Output
.

但是当我从命令行运行它时

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" C:\Users\Me\project\MySolution.sln /rebuild "Release|win32" /project C:\Users\Me\project\MyProject.vcxproj /out C:\DevEnv.log

它开始并行构建项目。

Microsoft (R) Visual Studio Version 10.0.30319.1. 
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Rebuild All started: Project: project1, Configuration: Release Win32 ------
2>------ Rebuild All started: Project: project2, Configuration: Release Win32 ------
3>------ Rebuild All started: Project: project3, Configuration: Release Win32 ------
4>------ Rebuild All started: Project: project4, Configuration: Release Win32 ------

是否有一个我缺少的标志或设置,以便在使用命令行时一次运行1?

编辑:应该注意我在Jenkins中运行这个版本。在命令提示符下运行上面的命令时似乎工作正常。但是在Jenkins中运行命令会导致构建并行执行。也许有一些环境变量需要设置?

1 个答案:

答案 0 :(得分:0)

我从未见过有人尝试使用devenv.exe从命令行构建解决方案。我认为那是因为devenv.exe Visual Studio。你最好还是使用MSBuild。任何VS做MSBuild应该能够做到的,因为VS使用了MSBuild。它应该能够构建您的解决方案和/或项目文件而无需修改。

既然你说你正在使用Jenkins for CI,请查看Jenkins的这个MSBuild插件。

https://wiki.jenkins-ci.org/display/JENKINS/MSBuild+Plugin