I am currently building a 64x .netcore2.2 application, with the publish settings as self-contained, with 64x architecture. Whenever I attempt to run the application, I get the following exception:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. An attempt was made to load a program with an incorrect format. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
--- End of inner exception stack trace ---
From my experience this is always when you're trying to run the wrong architecture with the wrong application, but in this case I'm running a x64 machine as well. I've also tried to build in 86x, but get the same error.
My previous attempts I made was to build it framework-dependant, but then I get an issue where the System.Runtime files aren't included in the output.
I'm running VS 2019.
ANY direction will be appreciated at the moment, since this has been a 2-day struggle.
User contributions licensed under CC BY-SA 3.0