Skip to content

Stop inferring the PlatformTarget in the SDK when targeting modern .NET applications #42558

Open
@baronfel

Description

@baronfel
          Also, you may want to stop inferring the `PlatformTarget` in the SDK when targeting modern .NET applications: 

<!-- Determine PlatformTarget (if not already set) from runtime identifier. -->
<Choose>
<When Condition="'$(PlatformTarget)' != '' or '$(RuntimeIdentifier)' == ''" />
<When Condition="$(RuntimeIdentifier.EndsWith('-x86')) or $(RuntimeIdentifier.Contains('-x86-'))">
<PropertyGroup>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
</When>
<When Condition="$(RuntimeIdentifier.EndsWith('-x64')) or $(RuntimeIdentifier.Contains('-x64-'))">
<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
</When>
<When Condition="$(RuntimeIdentifier.EndsWith('-arm')) or $(RuntimeIdentifier.Contains('-arm-'))">
<PropertyGroup>
<PlatformTarget>arm</PlatformTarget>
</PropertyGroup>
</When>
<When Condition="$(RuntimeIdentifier.EndsWith('-arm64')) or $(RuntimeIdentifier.Contains('-arm64-'))">
<PropertyGroup>
<PlatformTarget>arm64</PlatformTarget>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
</Otherwise>
</Choose>

Originally posted by @jkotas in #42556 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-NetSDKgood first issueIssues that would be a good fit for someone new to the repository. Narrow in scope, well-defined.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions