question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.net6.0 app publish in anyCPU does not run on windows 32bits

See original GitHub issue

Description

I try to run my .net6.0 app on 32 bits system and when I run the execute file it’s thrown an error :

image

When I am building the app only with x86 CPU the application it’s running correctly.

Reproduction Steps

  1. Create new consol projetct in .net6.0
  2. In the main code just put that :
using System;
Console.WriteLine("Hello, World!");
  1. And now publish with this profile settings :

image

  1. 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:

image

Regression?

It’s working in .net framework.

Known Workarounds

No response

Configuration

No response

Other information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
lextmcommented, Nov 11, 2022
2reactions
vitek-karascommented, Jul 13, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found