MSBuild条件IsDebug [英] MSBuild Condition IsDebug
问题描述
如何确定项目是否在MSBuild .targets文件中以调试(或发布)模式构建,并将此信息用作其他属性的条件?
How can I determine if a project is build in Debug (or Release) mode within an MSBuild .targets file and use this information as a condition for another property?
类似的东西:
<OutDir Condition="IsDebug">bin\Debug\$(SomeOtherProperty)\</OutDir>
<OutDir Condition="!IsDebug">bin\Release\$(SomeOtherProperty)\</OutDir>
是否存在诸如调试/发布"模式之类的东西,还是只是针对不同配置属性值集的常规名称?
Is there such thing as Debug/Release mode, or are they just conventional names for different sets of configuration properties' values?
推荐答案
调试/发布或Configuration
属性的常规值.
Debug/Release or whatever are just conventional values for the Configuration
property.
因此,只要包含/调用您的.targets文件的项目遵守约定;您可以按以下方式检查调试模式:
So, as long the project that includes/calls your .targets file adheres to the convention; you can check for debug mode as follows:
<OutDir>bin\Release\$(SomeOtherProperty)\</OutDir>
<OutDir Condition=" '$(Configuration)' == 'Debug' ">bin\Debug\$(SomeOtherProperty)\</OutDir>
或者您可以直接使用该变量:
or you could just use that variable directly:
<OutDir>bin\$(Configuration)\$(SomeOtherProperty)\</OutDir>
这篇关于MSBuild条件IsDebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!