Skip to content

dotnet publish errors with MSB4186 sdk 10.0.200 #53385

@ToSec-faha

Description

@ToSec-faha

Describe the bug

Running dotnet publish with sdk version 10.0.200 errors with: MSB4186: Invalid static method invocation syntax.

I do not think we have any custom tasks that causes this.

I assume this is because a file contains ',' in its filename.

The publish still works if done through VS Studio 2026 - 18.4.0

I found similar issue:

Exceptions (if any)

C:\Program Files\dotnet\sdk\10.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(851,9): error MSB4186: Invalid static method invocation syntax: "[MSBuild]::MakeRelative($(MSBuildProjectDirectory), C:\ProjectPath\wwwroot\css\Open_Sans_300,400,600,700.css)". Method '[MSBuild]::MakeRelative' not found. 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.

Further technical details

details of dotnet --info

.NET SDK: Version: 10.0.200 Commit: 40cd698e5c Workload version: 10.0.200-manifests.b7278506 MSBuild version: 18.3.0-release-26119-122+40cd698e5

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.200\

- VS Studio 2026 - 18.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions