Hi,
wherever I have to process a condition to set the value of a property, I conclude by making a few very rare lines ofMSBuild. I’m going to sign this post so that within 2 hours I remember as I resolve it in a simple way.
In the following example, we see that Target1 shows the value of the property $(Log). The value of the same is processed between 4 and 8, lines and depending on whether there is or not a file log, the property can take the values:
- There is no Log
- c:\file1.log
- c:\file2.log
1: <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
2: InitialTargets=”Target1″>
3: <PropertyGroup>
4: <Log1>c:\file1.log</Log1>
5: <Log2>c:\file2.log</Log2>
6: <Log>No hay Log</Log>
7: <Log Condition=”Exists(‘$(Log1)’)”>$(Log1)</Log>
8: <Log Condition=”Exists(‘$(Log2)’)”>$(Log2)</Log>
9: </PropertyGroup>
10: <Target Name=”Target1″>
11: <Message Text=”Start Demo” />
12: <Message Text=”Log: $(Log)” />
13: </Target>
14: </Project>
Simple and easy
Greetings @ Here
The Bruno