使用MSBuild时覆盖解决方案配置

时间:2017-04-04 22:46:35

标签: msbuild visual-studio-2017

我正在尝试使用自定义配置构建解决方案" Staging"使用MSBuild命令参数/ p:Configuration = Staging,但我总是从解决方案属性中获取当前配置,并忽略该参数。

当我将第一个项目设置为Release并传递/ p:Configuration = Staging时,我仍然获得Release而不是Staging。

我正在使用VS2017。enter image description here

我使用

打印消息
<Target Name="temp" BeforeTargets="PrepareForBuild">
    <Message Text="Custom message Current configuration: $(Configuration)" />
  </Target>

我收到了消息Custom message Current configuration: Release

当我从解决方案属性页面更改配置为调试并使用MSBuild / p:Configuration = Staging构建时,我得到了Custom message Current configuration: Debug

如何在使用MSBuild时覆盖解决方案配置?

更新:

这是解决方案配置

enter image description here

0 个答案:

没有答案
相关问题