How do I change a property's value based on a conditional in msbuild?
- by Noel Kennedy
I would like to change the value of a property if it is a certain value. In C# I would write:
if(x=="NotAllowed")
x="CorrectedValue;
This is what I have so far, please don't laugh:
<PropertyGroup>
<BranchName>BranchNameNotSet</BranchName>
</PropertyGroup>
///Other targets set BranchName
<Target Name="CheckPropertiesHaveBeenSet">
<Error Condition="$(BranchName)==BranchNameNotSet" Text="Something has gone wrong.. branch name not entered"/>
<When Condition="$(BranchName)==master">
<PropertyGroup>
<BranchName>MasterBranch</BranchName>
</PropertyGroup>
</When>
</Target>