gpt4 book ai didi

.net - MSBuild 条件 IsDebug

转载 作者:行者123 更新时间:2023-12-03 18:16:58 25 4
gpt4 key购买 nike

如何确定项目是否在 MSBuild .targets 文件中以调试(或发布)模式构建,并将此信息用作另一个属性的条件?

就像是:

<OutDir Condition="IsDebug">bin\Debug\$(SomeOtherProperty)\</OutDir>
<OutDir Condition="!IsDebug">bin\Release\$(SomeOtherProperty)\</OutDir>

是否有调试/ Release模式之类的东西,或者它们只是不同配置属性值集的常规名称?

最佳答案

调试/发布或其他只是 Configuration 的常规值属性(property)。

因此,只要包含/调用您的 .targets 文件的项目遵守约定;您可以按如下方式检查 Debug模式:

<OutDir>bin\Release\$(SomeOtherProperty)\</OutDir>
<OutDir Condition=" '$(Configuration)' == 'Debug' ">bin\Debug\$(SomeOtherProperty)\</OutDir>

或者您可以直接使用该变量:
<OutDir>bin\$(Configuration)\$(SomeOtherProperty)\</OutDir>

关于.net - MSBuild 条件 IsDebug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20800726/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com