I have a condition looking for a path that has a "." in the file name, it looks something like this
Condition="Exists($(FirstPart).$(SecondPart))"
But I get an error saying:
"." was an unexpected token.
Any tips on how I can do this?
As far as I'm aware, . isn't a special character, and it still doesn't work when I try to escape it.
You might just need to add a ' on either side of your condition, like:
Condition="Exists('$(FirstPart).$(SecondPart)')"
That removed the error MSB4092: An unexpected token "." was found at character position 20 in condition "Exists($(FirstPart).$(SecondPart))" you were seeing for me.
Here is my test code:
<Target Name="BeforeBuild" Condition="Exists('$(FirstPart).$(SecondPart)')">
<Message Text="Hit target." />
</Target>
And output:
1>Target "BeforeBuild" in project "..." (entry point):
Task "Message"
Hit target.
Done executing task "Message".
MSDN Reference: MSBuild Conditions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With