MSB4186 diagnostic code
This article describes the MSB4186 error code.
Message text
MSB4186: Invalid static method invocation syntax: 'value'. 'value' Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order.
Remarks
This error occurs when MSBuild encounters a function invocation that uses an invalid syntax for calling a static method. In MSBuild, static methods must be invoked using the correct syntax: $([FullTypeName]::Method(Parameters))
.
Resolution
To resolve this error, ensure that the static method is invoked using the proper syntax, including the closing ]
and the ::
:
<PropertyGroup>
<MyProperty>$([ClassName]::MethodName('a', 'b'))</MyProperty>
</PropertyGroup>
Applies to
All versions of MSBuild