Skip to content

System.Private.CoreLib's "Platform" is always set to AnyCPU when building inside Visual Studio which causes build failures #97984

Open
@ViktorHofer

Description

@ViktorHofer

Reported in #97969

When building System.Private.CoreLib as a dependency of i.e. System.Threading.csproj, the Platform global property is always set to AnyCPU even though dotnet/runtime sets it to TargetArchitecture:

<InferPlatformFromTargetArchitecture>true</InferPlatformFromTargetArchitecture>

Looking at a full fidelity binlog created by the project system tools, I can see that this is related to our custom Microsoft.DotNet.Build.Tasks.TargetFramework component:

image

The target from our custom component is slightly different than what is inbox in msbuild: https://github.com/dotnet/msbuild/blob/bea6b4aebe6548d714ca643db9107162965b94d5/src/Tasks/Microsoft.Common.CurrentVersion.targets#L1755-L1951

Probably most relevant is that our custom target doesn't support the EnableDynamicPlatformResolution setting which might be the reason why SetPlatform is passed in with a value of "AnyCPU".

This causes builds to fail, i.e. .\build.cmd -os browser -subset mono+libs && .\build.cmd -vs src\libraries\System.Runtime.InteropServices.JavaScript\System.Runtime.InteropServices.JavaScript.sln -rf Mono -os browser:

image

cc @ericstj

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions