Skip to content

Flag usage of non-AnyCPU values for PlatformTarget in modern .NET applications #42556

Open
@baronfel

Description

@baronfel

Is your feature request related to a problem? Please describe.

The PlatformTarget field (and therefore Platform in MSbuild) only applies to .NET Framework and doesn't apply to modern .NET applications. For these applications, Platform can (should) always be AnyCPU. We should guide users to removing customizations to this property for projects that do not need it.

From Jan Kotas in #42344:

PlatformTarget is left-over from .NET Framework. (PlatformTarget can only represent architectures that .NET Framework targets. It does not represent full range of platforms that .NET Core can target.)

If you are targeting current .NET, building everything as AnyCPU (ie hardcoding PlatformTarget to AnyCPU) all the time should work just fine. It is what we are doing in dotnet/runtime repo. We hardcode PlatformTarget to AnyCPU, even for platform-specific binaries.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions