MSBuild engine returns error MSB4186 for '$([MSBuild]::Add($(OldRevision), 1))' statement. I'm using an example from here, but it does not work for me:
error MSB4186: Invalid static method invocation syntax:
"[MSBuild]::Add($(OldRevision), 1)". Input string was not in a correct format.
Static method invocation should be of the form: $([FullTypeName]::Method()),
e.g. $([System.IO.Path]::Combine(`a`, `b`))
Here is what I'm trying to perform:
<CreateProperty Value="$([MSBuild]::Add($(OldRevision), 1))">
<Output
TaskParameter="Value"
PropertyName="NewRevision" />
</CreateProperty>
I wonder what is tha proper syntax for it
p.s. yes, I'm using MSBuild 4.5
I think you got this property syntax right, it is just not working in CreateProperty task. CreateProperty function is deprecated, there are very few reasons to use it.
This simpler property syntax works for me:
<PropertyGroup>
<NewVersion>$([MSBuild]::Add($(OldVersion), 1))</NewVersion>
</PropertyGroup>
Also this works as well (inside any target):
<Message Text="OldVersion=$(OldVersion), NewVersion=$([MSBuild]::Add($(OldVersion), 1))" />
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