【问题标题】:How to build some project configurations with msbuild如何使用 msbuild 构建一些项目配置
【发布时间】:2011-06-07 20:45:00
【问题描述】:

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?

【问题讨论】:

标签: visual-studio msbuild googletest


【解决方案1】:
MSBuild projectfile /property:Configuration=Debug

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

【讨论】:

  • 或 /p:Configuration=Debug
  • 也可以用/property:Platform=Win32设置平台。
【解决方案2】:

Kyle Alons 的回答很好。当我运行具有四个项目的解决方案文件时,它会生成每个项目的发布版本。

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

我可以按如下方式运行每个项目,但是输出名称是基于解决方案名称的,所以我需要修改以获得正确的结果。

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

解决方案是如下指定目标。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-07
    • 1970-01-01
    • 2015-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-27
    相关资源
    最近更新 更多