I am trying to use MSBuild community tasks to remove the slash from the end of the OutputPath
This is what i have so far.
<RegexReplace Input="$(OutputPath)" Expression="\$" Replacement="" Count="1">
<Output ItemName="FormattedOutputPath" TaskParameter="Output" />
</RegexReplace>
<Message Text="@(FormattedOutputPath)"/>
Unfortunately the message just returns my path still with the slash on the end.
The path is C:\MyDirectory\
It looks like my expression is incorrect
Can anyone help?
Slash is using as an escape character, so in pattern you have to escape slash character by another slash:
To better understand escaping see the following examples:
$represents end of line/string\$represents dollar sign character\\represents slash character\\$represents slash character at the end of line/string