Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ARM32 & ARM64 As AvailablePlatforms #6322

Closed
wants to merge 1 commit into from

Conversation

benvillalobos
Copy link
Member

@benvillalobos benvillalobos commented Apr 2, 2021

Fixes #5951

Context

Summary: .NET 5 is adding support for Windows ARM64. Visual Studio .NET Core projects should allow you target ARM64 in addition to x86/x64/arm32.

This is planned to be based off of the AvailablePlatforms property.

Changes Made

In Microsoft.Common.CurrentVersion.targets, added conditional propertygroups based on TargetFramework to add ARM32/64 as a platform.

Testing

Needs dotnet/project-system#7081 to account for AvailablePlatforms so we can see it in the Platform Target dropdown under project properties.

Notes

What we're trying to apply ARM to:

Version Windows Linux macOS
.NET Core 2.1 x86, x64 x86, x64, arm32 x64
.NET Core 3.1 x86, x64, arm32 x86, x64, arm32, arm64 x64
.NET 5 x86, x64, arm64 (console only) x86, x64, arm32, arm64 x64

<AvailablePlatforms Condition="$([MSBuild]::IsOSPlatform('linux'))">$(AvailablePlatforms),ARM32,ARM64</AvailablePlatforms>
</PropertyGroup>

<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net5.0'))">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this strictly check for net5.0, or is anything greater than/compatible with net5.0 fine? /cc: @tommcdon

</PropertyGroup>

<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net5.0'))">
<!-- Need to check console and windows here. -->
Copy link
Member Author

@benvillalobos benvillalobos Apr 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From original issue:

@dsplaisted how do we go about checking if we're specifically a console app?

The only reference to a console app check I've found is line 5647 on Microsoft.Common.CurrentVersion.Targets:
<Error Condition="'$(OutputType)'!='winexe' and '$(OutputType)'!='exe' and '$(OutputType)'!='appcontainerexe'" Text="Publish is only valid for 'Windows Application' or 'Console Application' project types."/>

Non-console apps would have a FrameworkReference to the WindowsDesktop or AspNetCore framework. There wouldn't be a RuntimePack for the ARM RuntimeIdentifiers that aren't supported, so you'd get an error building a self-contained app targeting ARM. I don't think we have a block that would prevent you from building a shared framework app using an ARM RuntimeIdentifier.

Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first inclination would be to put this logic in dotnet/sdk instead of in MSBuild. That's generally where we put logic that is specific to .NET 5 / .NET Core, as you need to use SDK-style projects to build for those platforms.

This also should not be checking exact strings for the TargetFramework. It should check TargetFrameworkIdentifier and TargetFrameworkVersion.

@benvillalobos
Copy link
Member Author

@dsplaisted Understood, is there an ideal file to place this logic into? Microsoft.Net.Sdk.targets maybe?

@benvillalobos
Copy link
Member Author

Closing in favor of dotnet/sdk#16802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ARM64 as a supported architecture
2 participants