Skip to main content

Posts

Showing posts from March, 2022

Visual Studio 2022 - Run-time Exception System.BadImageFormatException

I had this problem in visual studio 2022 after taking an application that was originally using the .net 35 framework and change it to .net 4.8. After this change, the application compiles without errors, but throws this error at runtime: System.BadImageFormatException was unhandled Message: An unhandled exception of type 'System.BadImageFormatException' occurred in Unknown Module. Additional information: Could not load file or assembly 'TimersXP.exe' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. SOLUTION: Change the APP.CONFIG file, leaving the <STARTUP> section with the 4.0 framework only. After that, I did a CLEAR on the project and a BUILD. And the app.config has been changed to: BEFORE: <startup>     <supportedRuntime version="v2.0.50727"/>     <supportedRuntime version="v4.0"/> </startup> LATER: I removed the line <supportedRuntime ve