Msbuild 是否识别除 DEBUG|RELEASE 之外的任何构建配置 [英] Does Msbuild recognise any build configurations other than DEBUG|RELEASE
问题描述
我通过 Visual Studio 创建了一个名为 Test 的配置,该配置目前只接受所有 DEBUG 设置,但是如果构建恰好是 TEST|DEBUG|RELEASE,我会使用编译器条件来确定一些特定操作.
I created a configuration named Test via Visual Studio which currently just takes all of DEBUG settings, however I employ compiler conditions to determine some specific actions if the build happens to be TEST|DEBUG|RELEASE.
但是如何让我的 MSBUILD 脚本检测 TEST 配置?
However how can I get my MSBUILD script to detect the TEST configuration??
目前我正在构建
<MSBuild Projects="@(SolutionsToBuild)" Properties="Configuration=$(Configuration);OutDir=$(BuildDir)Builds" />
@(SolutionsToBuild) 是我的解决方案.在 Common MsBuild 项目属性 中,它指出 $(Configuration) 是共同财产,但它总是显示为空白?
Where @(SolutionsToBuild) is a my solution. In the Common MsBuild Project Properties it states that $(Configuration) is a common property but it always appears blank?
这是否意味着它永远不会被设置,而只是保留给我使用,或者它只能检测 DEBUG|RELEASE.如果是这样,允许创建不同的构建配置有什么意义?
Does this mean that it never gets set but is simply reserved for my use or that it can ONLY detect DEBUG|RELEASE. If so what is the point in allowing the creation of different build configurations?
推荐答案
我在定义 MSBUILD 配置文件方面做得不多,但我已经使用像这样的批处理文件构建了不同的配置
I haven't done much with defining an MSBUILD configuration file but I have done builds of different configurations using a batch file like this
msbuild /v:n /p:Configuration=Release "Capture.sln"
msbuild /v:n /p:Configuration=ReleaseNoUploads "Capture.sln"
我在 Visual Studio 中定义了 ReleaseNoUploads 配置.
I defined the ReleaseNoUploads configuration inside Visual Studio.
这是我必须做的(这是 Visual Studio 2005):
Here's what I had to do for that (this is Visual Studio 2005):
- 打开Tools:Options菜单,进入Projects and Solutions:General选项,勾选Show advanced build configurations.李>
- 从那里转到 Build:Configuration 管理器菜单
- 在弹出的对话框中,点击 Active solution configuration 下拉菜单并点击 <New...> 以创建新的构建配置.李>
- Open the Tools:Options menu, go to the Projects and Solutions:General option, and check Show advanced build configurations.
- From there, go to the Build:Configuration Manager menu
- In the dialog that pops up, click on the Active solution configuration pulldown and click <New...> to create a new build configuration.
这篇关于Msbuild 是否识别除 DEBUG|RELEASE 之外的任何构建配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!