I’m developing a .NET 7 app on Windows 11, Arm64. Compiling for “any CPU”. When trying to run the app in X64 computers, I get an error saying “This app can’t run on your PC”. The computer has .NET 7 SDK and runtime installed.
If I compile the app using .NET Framework 4.8 on the Arm64 computer, it works properly on the x64 computer as well. What is the issue with .NET 7 here?
You can try using
dotnet
to run your compiled dll or publish the app (via the UI or usingdotnet publish
) providing architecture specific runtime identifier (RID) for example -win-x64
. Note the--self-contained
parameter which by default is true when RID is specified and the project is an executable one:Which will lead to publishing all components of the app, including the .NET libraries and target runtime (see the corresponding docs). Set it to
false
to publish framework-dependent executable, for example:Also you can consider using publish profile files.