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 ARM64 as a supported architecture #5951

Closed
tommcdon opened this issue Aug 4, 2020 · 23 comments · Fixed by dotnet/sdk#16802
Closed

Add ARM64 as a supported architecture #5951

tommcdon opened this issue Aug 4, 2020 · 23 comments · Fixed by dotnet/sdk#16802
Assignees
Labels
Milestone

Comments

@tommcdon
Copy link
Member

tommcdon commented Aug 4, 2020

Visual Studio Version: 16.8

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.

Steps to Reproduce:

  1. Create a .NET Core Console / Unit Test / ASP.NET Core project

  2. Under Project properties, Build, you should be able to select "ARM64" as a target architecture

@jjmew jjmew transferred this issue from dotnet/project-system Aug 4, 2020
@jjmew
Copy link

jjmew commented Aug 4, 2020

The project system get this information directly from the SDK

@davkean
Copy link
Member

davkean commented Aug 5, 2020

This is controlled by <AvailablePlatforms> property which is provided by us from the build.

@jjmew
Copy link

jjmew commented Aug 5, 2020

@davkean I thought you said it came from the SDK. I am confused now, on what it will take to show x64. Should the template automatically add ARM64 to the and burn it to the project file?

@davkean
Copy link
Member

davkean commented Aug 5, 2020

The SDK is the build, I was just adding context to the bug.

@tommcdon
Copy link
Member Author

@hoyosjs

@hoyosjs
Copy link
Member

hoyosjs commented Aug 18, 2020

Is it this one?

<AvailablePlatforms Condition="'$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' > '10.0'">Any CPU,x86,x64</AvailablePlatforms>

I'd set it locally to verify directly on the SDK, but I still don't get a configuration available.
image

image

@dsplaisted
Copy link
Member

I think the configuration manager is something else. This bug is referring to the Platform Target in the project properties:

image

I can confirm that modifying the AvailablePlatforms property does add items to this dropdown (though it's not easy to do so because it is set in the common targets).

@dsplaisted dsplaisted removed their assignment Dec 4, 2020
@marcpopMSFT marcpopMSFT transferred this issue from dotnet/sdk Dec 9, 2020
@ryalanms
Copy link
Member

/cc @dotnet/wpf-developers

@predavid
Copy link

@dotnet/sdk - when will the ARM64 option be made available in the Platform Target drop-down?

@tommcdon
Copy link
Member Author

@tmeschter

@marcpopMSFT
Copy link
Member

@benvillalobos check with Daniel on what are the risks of us updating the AvailablePlatforms in common targets. @tommcdon , are there any restrictions on when to show ARM64 and ARM32? I think the risk here is that MSBuild may not be aware of projects that don't support those targets.

@tommcdon
Copy link
Member Author

tommcdon commented Feb 1, 2021

@tommcdon , are there any restrictions on when to show ARM64 and ARM32? I think the risk here is that MSBuild may not be aware of projects that don't support those targets.

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

@marcpopMSFT marcpopMSFT added this to the MSBuild 16.10 milestone Feb 25, 2021
@marcpopMSFT
Copy link
Member

@benvillalobos I went ahead and put this in 16.10 as I think we have what we need from Tom.

@benvillalobos
Copy link
Member

@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."/>

@benvillalobos
Copy link
Member

I'm not seeing any changes adding ARM64 to AvailablePlatforms:
image

@davkean
Copy link
Member

davkean commented Apr 1, 2021

@drewnoakes How are you populating above?

@dsplaisted
Copy link
Member

@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.

@drewnoakes
Copy link
Member

drewnoakes commented Apr 2, 2021

How are you populating above?

Those options are currently hard coded here:

https://github.com/dotnet/project-system/blob/20d7f46f0f492dfabcd61b7462e532b8229ca005/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Rules/PropertyPages/BuildPropertyPage.xaml#L39-L50

If they can be sourced from somewhere, we can add a dynamic enum value provider that surfaces them.

@davkean
Copy link
Member

davkean commented Apr 2, 2021

They are already provided by the <AvailablePlatforms> property.

@tmeschter
Copy link
Contributor

Surfacing it in the new property pages is now tracked via dotnet/project-system#7081. The current plan is to read the allowable values from <AvailablePlatforms> and we will depend on the SDK to populate that correctly.

@davkean
Copy link
Member

davkean commented Apr 3, 2021

Note that the property pages have always read it (indirectly) from AvailablePlatforms. This was a regression from the prior pages.

@austinkinross
Copy link

Until this is fixed, what's the best way (if any) to make MSBuild pass /platform:ARM64 to CSC?

@benvillalobos
Copy link
Member

benvillalobos commented Apr 6, 2021

@austinkinross At first glance, it looks like MSBuild calls csc and includes the platform like so: Platform="$(PlatformTarget)". Setting platformtarget affects PlatformTargetAsMSBuildArchitecture and ProcessorArchitecture properties (and likely others I'm not aware of), which will likely have adverse side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment