Con*_*rev 6 versioning msbuild build-automation build
MSBuild引擎为'$([MSBuild] :: Add($(OldRevision),1))'语句返回错误MSB4186.我在这里使用一个例子,但它对我不起作用:
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`))
Run Code Online (Sandbox Code Playgroud)
这是我正在尝试执行的操作:
<CreateProperty Value="$([MSBuild]::Add($(OldRevision), 1))">
<Output
TaskParameter="Value"
PropertyName="NewRevision" />
</CreateProperty>
Run Code Online (Sandbox Code Playgroud)
我想知道它的正确语法是什么
ps是的,我正在使用MSBuild 4.5
我认为您的属性语法是正确的,它只是在 CreateProperty 任务中不起作用。CreateProperty 函数已被弃用,很少有理由使用它。
这个更简单的属性语法对我有用:
<PropertyGroup>
<NewVersion>$([MSBuild]::Add($(OldVersion), 1))</NewVersion>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
这也适用(在任何目标内):
<Message Text="OldVersion=$(OldVersion), NewVersion=$([MSBuild]::Add($(OldVersion), 1))" />
Run Code Online (Sandbox Code Playgroud)