0

I began developing this project on another computer in "Any Cpu" mode. Then after a while, I added a x64 C++CLI project reference to it and the only way it would not give me the "bad image" exception was when I switched the asp project to x64 too.

Even then it was giving me errors on build, every now and then it would complain about msbuild.exe being inaccessible but I think this problem is unrelated (msbuild.exe's were just piling up in task manager).

Anyways, I now migrated the project to another computer and its refusing to build it in x64 mode no matter what. I get the

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.BadImageFormatException: Could not load file or assembly 'ProjectName' or one of its dependencies. An attempt was made to load a program with an incorrect format.

With no useful detail at all. I tried removing all its references but still, as long as its in x64, it wont run, runs fine in "Any Cpu" mode but this won't work with the library I'm using. Also it works fine when just deployed in my IIS server.

Does anybody have a clue about whats going on?

EDIT: I found my answer here: https://stackoverflow.com/a/23867475/4049658

This can't be normal though, right? Why do people have to go modifying the registry just to get to debug in x64?

Community
  • 1
  • 1
user81993
  • 6,167
  • 6
  • 32
  • 64
  • 1
    You need to debug in x64, and you're using IIS Express? There's a flag you need to set for that in Studio, it's in the project settings, Tools | Options | Projects and Solutions | Web Projects | Use the 64 bit version of IIS Express – Nikki9696 Mar 25 '16 at 20:42
  • The registry setting is to make that option be the DEFAULT. But you can override the default via that UI checkbox. – Nikki9696 Mar 25 '16 at 20:44
  • See my answer on **[System.BadImageFormatException: Reference assemblies should not be loaded for execution](https://stackoverflow.com/questions/61336306/system-badimageformatexception-reference-assemblies-should-not-be-loaded-for-ex/61702386#61702386)**. – Murat Yıldız May 09 '20 at 19:21

0 Answers0