Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Asp.Net core on Visual Studio as 32bit

I just converted a project from MVC 4 to ASP.NET Core 1.0. This project does some pinvoke on a 32bit dll and when I try to debug it, I get that bad image exception.

If I deploy it using dotnet publish -c Release -r win7-x86 it works perfectly fine, but I can't debug it or run through visual studio.

like image 377
user3900456 Avatar asked Jul 04 '16 00:07

user3900456


People also ask

Can I use .NET core in Visual Studio 2013?

NETCore means squat to programmers that have access to VS2013, they have been able to use it for a long time. It was open-sourced so programmers that don't use Microsoft tools and runtime environments can take advantage of it.

What version of Visual Studio do I need for .NET core?

Install Visual StudioNET Core 2.1 and . NET Core 3.1 is having long term support. Visual Studio 2017 supports . NET Core 2.1, whereas Visual Studio 2019 supports both the versions.

Is .NET core 64 bit?

NET Core SDK and runtimes. In almost all cases the right version of the SDK to download and is the 64 bit version unless you are running on 32 bit Windows version (hopefully not).


1 Answers

You need to either publish the app as standalone app 32bit or, if it's a shared framework app, then you need to start it with a 32 bit dotnet.

If you already have the app running in 32 bit mode, then you can attach VS to it.

If you want VS to always use the 32 bit dotnet then you have to uninstall the dotnet in program files (or just remove it from the system PATH) and then install a dotnet that's 32 bit, making sure it's on the PATH. It's important to note that system PATH takes priority in Windows so adding something to the user's PATH will not work unless you remove the old one.

PS: I assume you're running on a 64 bit OS. Otherwise, you get the 32 bit dotnet by default.

like image 69
Victor Hurdugaci Avatar answered Oct 03 '22 05:10

Victor Hurdugaci