Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Description
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>
Check the parameters and ensure that the parameters are correct for the method, and if any properties are referenced in the expression, that the properties are defined, and have the correct values, and that the values provided for method parameters are valid inputs that match the type of each parameter.
Applies to
All versions of MSBuild