如何使用msbuild构建一些项目配置

时间:2011-01-12 14:02:02

标签: visual-studio msbuild googletest

gtest的msvc目录包含gtest项目文件,使用Visual Studio打开它可以让我通过Batch Build选择8种配置(gtest / gtest_main / gtest_prod_test / gtest_unittest x release / debug)的构建。

如何使用 msbuild 工具执行相同的操作?例如,如何告诉msbuild构建gtest / Debug或gtest_unittest / Release?

2 个答案:

答案 0 :(得分:46)

MSBuild projectfile /property:Configuration=Debug

http://msdn.microsoft.com/en-us/library/ms171452%28v=vs.80%29.aspx

答案 1 :(得分:1)

Kyle Alons's answer works fine. When I run solution file that has four projects, it generates the release version of each project.

msbuild gtest-md.sln /property:Configuration=Release

I could run each project as follows, but the output names are based on solution name, so I need to modify to get correct results.

msbuild gtest-md.vcxproj /property:Configuration=Release

The solution was to specify target as follows.

msbuild gtest-md.sln /target:gtest-md /property:Configuration=Release