.net6.0 app publish in anyCPU does not run on windows 32bits
See original GitHub issueDescription
I try to run my .net6.0 app on 32 bits system and when I run the execute file it’s thrown an error :
When I am building the app only with x86 CPU the application it’s running correctly.
Reproduction Steps
- Create new consol projetct in .net6.0
- In the main code just put that :
using System;
Console.WriteLine("Hello, World!");
- And now publish with this profile settings :
- Now test to execute the project on windows x86
Expected behavior
Normally the app can be excute on any cpu.
Actual behavior
The app execution does not work and it’s throwing this error:
Regression?
It’s working in .net framework.
Known Workarounds
No response
Configuration
No response
Other information
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
c# - Application compiled with AnyCPU can't run on 32bit ...
It doesn't do anything, just a Form with a Button. Now, when I deploy it to a 32bit machine (Windows 10), I got...
Read more >32-bit COM Assembly Doesn't Work With x86/AnyCPU ...
I have a web app which has list of projects, all under single solution. Many of them refers the COM DLLs which is...
Read more >Configure projects to target platforms - Visual Studio
Learn how Visual Studio enables you to set up your applications to target different platforms, including the Arm64 platform.
Read more >Downgrading a .NET Applications from 64 bit to 32 bit for the ...
If you launch an EXE created with Any CPU on a 64 bit machine the app will run 64 bit, and will run...
Read more >C# Target Platforms | x64 vs x86 vs AnyCPU
Assemblies compiled as AnyCPU or x86 will run as 32-bit process. At runtime they can can load AnyCPU and x86 assemblies but not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Summarized the issue, the cause and the solution in a simpler way https://learn.microsoft.com/en-us/answers/questions/1084428/wpf-application-does-not-work-on-32bit-os.html?childToView=1084800#answer-1084800
The fact this works in .NET Framework is… special. .NET Framework has an OS level hook which makes this possible. .NET 5+ doesn’t have any OS hooks, and so it has to play by the same rules as everybody else. Which is that .exe is native code and that can only run on the architecture it was built for.
The idea of portable .NET apps is that you don’t use the executable to run them, instead you use
dotnet app.dll
to run them - that should work on any architecture.