Replies: 7 comments
-
The general answer is, working just like how it works on x86/x64.
Most managed code are built for AnyCPU, not a combination of x86 and x64. You don't need to take any action for AnyCPU.
If the whole process is ARM64EC, CLR and x64 native dependency will both be emulated. Otherwise, it depends on how it's distributed. Modern NuGet model counts architecture together with OS for native assets. The native dependency will be considered missing for win-arm64.
Yes.
The "Platform" option of VS solution isn't friendly with modern NuGet asset model. The modern model of native dependency in NuGet looks like this:
For modern .NET you should pack your NuGet package like this. During |
Beta Was this translation helpful? Give feedback.
-
In short, ARM64 isn't special comparing to xarch platforms. If you don't want to shift the packaging model, you can just add a third entry for ARM64 for anywhere you are listing both x86 and x64. |
Beta Was this translation helpful? Give feedback.
-
It seems ARM64EC works only in Windows 11, does it mean that in Windows 10 can be problems with loading x64 code?
I would like to clarify how it works under the water. The compilation process generates IL code, which is low-level and platform-independent (should it work in x86/x64 and Arm64?). Then .Net Arm runtime uses JIT compiler to compile native machine code which is executed directly by the CPU. If it works as I described, why do we need to specify platforms in a project file and runtime identifiers? Why do we need to build separate versions for x64 and native arm64?
Do you mean runtime identifier? If I would like to use the same Nuget for both (x64 and arm64) builds. Do I need a separate Nuget package for both architectures? Or I could just define multiple runtime identifiers in the same project? |
Beta Was this translation helpful? Give feedback.
-
Do you mean just add Arm64 platform in all Nuget projects? |
Beta Was this translation helpful? Give feedback.
-
x64 emulation on ARM64 starts from 21xxx build. So only Windows 11 has the emulation feature.
Correct.
Sometimes the native interop code can be different due to incompatible data structures. But generally, all managed code should be AnyCPU as possible and shouldn't be built for separated architectures.
Yes, modern .NET picks native assets based on runtime identifier.
Both options work. There are patterns that package named <None Include="runtimes\**\native\*">
<Pack>true</Pack>
<PackagePath>runtimes</PackagePath>
</None>
Yeah, if you are already using x64 for all projects, add a new arm64 configuration may be an easy workaround for you. It needs separated package id for each package though. |
Beta Was this translation helpful? Give feedback.
-
@huoyaoyuan thank you for the detailed reply! ...
{354B6E46-B4EB-4CBE-95E2-FE3C30DA676D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{354B6E46-B4EB-4CBE-95E2-FE3C30DA676D}.Release|Any CPU.Build.0 = Release|Any CPU
{354B6E46-B4EB-4CBE-95E2-FE3C30DA676D}.Release|ARM64.ActiveCfg = Release|ARM64
{354B6E46-B4EB-4CBE-95E2-FE3C30DA676D}.Release|ARM64.Build.0 = Release|ARM64
{354B6E46-B4EB-4CBE-95E2-FE3C30DA676D}.Release|x64.ActiveCfg = Release|x64
{354B6E46-B4EB-4CBE-95E2-FE3C30DA676D}.Release|x64.Build.0 = Release|x64
{354B6E46-B4EB-4CBE-95E2-FE3C30DA676D}.Release|x86.ActiveCfg = Release|x86
{354B6E46-B4EB-4CBE-95E2-FE3C30DA676D}.Release|x86.Build.0 = Release|x86
... Project.csproj: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;</RuntimeIdentifiers>
<Platforms>AnyCPU;x64;x86;ARM64</Platforms>
</PropertyGroup>
...
</Project> CI builds Nuget package and pushed to private Nuget server:
Nuget package has only one dll file, there are no separate versions for x86, x64 and arm64. |
Beta Was this translation helpful? Give feedback.
-
You can verify the content of NuGet package with NuGetPackageExplorer and the characteristics of dlls with ILSpy. Basically:
You can test nuget with local folder without pushing to any server. See https://learn.microsoft.com/en-us/nuget/hosting-packages/local-feeds . |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, I would like to get more information on how arm64 runtime works and how .Net application should be configured to get the best performance.
There is a .NET 7 self-contained WPF application with Arm64 platform. It works in most cases in Arm64 OS. The app has a lot of dependencies and I’m worrying about application performance.
I’m aware that it is possible to run x86 or x64 applications on Arm64 computer, but it is not optimized, performance is poor and the app drains the device’s battery.
Here is a dependency diagram:

As you can see the app depends on:
How these dependencies should be updated to work well with Arm64 application on Arm64 computer?
Could you please confirm or adjust my assumptions?
P.S. I'm not sure that this repository is the best place to ask these questions. Please let me know if there is a better place and I will move the issue.
Beta Was this translation helpful? Give feedback.
All reactions