gpt4 book ai didi

msbuild - 在 MSBuild 的属性组中是否存在 "if"类型语句?

转载 作者:行者123 更新时间:2023-12-03 23:32:13 25 4
gpt4 key购买 nike

我目前必须有两个单独的属性组,它们之间只有两个差异,根据条件设置为具有一个或另一个触发器。这是我所拥有的:

<!--CAME FROM TEAMBUILD-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' != 'Debug|AnyCPU' AND '$(Configuration)|$(Platform)' != 'Release|AnyCPU' AND '$(BuildingInsideVisualStudio)' != 'true' ">
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
set MAGE="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\mage.exe"
set APPFILE=$(TargetDir)$(TargetName).application
set MANIFEST=$(TargetPath).manifest
set CERT=$(ProjectDir)$(TargetName).pfx
set PROJECTNAME=$(TargetName)
set CONFIGURATION=$(ConfigurationName)
set TARGETDIR=$(TargetDir)
set TEAMBUILD=$True
Powershell -File "$(ProjectDir)POSTBUILD.ps1"
</PostBuildEvent>
</PropertyGroup>

<!--CAME FROM PUBLISH COMMAND-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' != 'Debug|AnyCPU' AND '$(Configuration)|$(Platform)' != 'Release|AnyCPU' AND '$(BuildingInsideVisualStudio)' == 'true' ">
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
set MAGE="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\mage.exe"
set APPFILE=$(TargetDir)$(TargetName).application
set MANIFEST=$(TargetPath).manifest
set CERT=$(ProjectDir)$(TargetName).pfx
set PROJECTNAME=$(TargetName)
set CONFIGURATION=$(ConfigurationName)
set TARGETDIR=$(TargetDir)
set TEAMBUILD=$False
Powershell -File "$(ProjectDir)POSTBUILD.ps1"
</PostBuildEvent>
</PropertyGroup>

有没有办法根据构建后事件中的 $(BuildingInsideVisualStudio) 值设置 teambuild 值?
就像是

如果 ($(BuildingInsideVisualStudio) == 'true')
设置 TEAMBUILD = $True

或者
甚至像
set TEAMBUILD = $$(BuildingInsideVisualStudio) ?

最佳答案

您已经在使用它:Condition .您只需提取一个额外的步骤来创建将用作 TEAMBUILD 值的属性。例如:

<PropertyGroup Condition='$(BuildingInsideVisualStudio)' != 'true' ">
<TeamBuildValue>FALSE</TeamBuildValue>
</PropertyGroup>

<PropertyGroup Condition='$(BuildingInsideVisualStudio)' == 'true' ">
<TeamBuildValue>TRUE</TeamBuildValue>
</PropertyGroup>

<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
...
set TEAMBUILD=$(TeamBuildValue)
...
</PostBuildEvent>
</PropertyGroup>

关于msbuild - 在 MSBuild 的属性组中是否存在 "if"类型语句?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17979566/

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