43

The gtest's msvc directory has the gtest project file, and opening it with Visual Studio enables me to select the build out of 8 configurations(gtest/gtest_main/gtest_prod_test/gtest_unittest x release/debug) with Batch Build.

How can I do the same thing with msbuild tool? For example, how can I tell msbuild to build gtest/Debug or gtest_unittest/Release?

prosseek
  • 182,215
  • 215
  • 566
  • 871
  • 1
    See a good post with msbuild and devenv examples http://miteshsureja.blogspot.com.au/2012/04/how-to-build-solution-or-project-from.html – Michael Freidgeim Nov 25 '12 at 11:52
  • You don't want to put the Solution in the question. Solutions should be put as an answer. – Mangs Oct 20 '16 at 09:05

2 Answers2

65
MSBuild projectfile /property:Configuration=Debug

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

gunr2171
  • 16,104
  • 25
  • 61
  • 88
Kyle Alons
  • 6,955
  • 2
  • 33
  • 28
2

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
prosseek
  • 182,215
  • 215
  • 566
  • 871