Could not load file or assembly msshrtmi or one of its dependencies
Could not load file or assembly ‘msshrtmi’ or one of its dependencies. An attempt was made to load a program with an incorrect format.
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 ‘msshrtmi’ or one of its dependencies. An attempt was made to load a program with an incorrect format. Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly ‘msshrtmi’ could not be loaded.
You get this error when you create an Azure Project in your solution and then subsequently try to run the Web Project. For some reason, Visual Studio adds
<PlatformTarget>AnyCPU</PlatformTarget> to the projects configuration file when the Azure Project is created which ends up breaking the web project.
To fix this problem, perform the following steps:
- Unload project
- Edit Project
- Delete all instances of
<PlatformTarget>AnyCPU</PlatformTarget>(I had two)
- Save Edits
- Reload Project
- Delete all bin/obj folders (super important)
- Clean Solution
- Run Solution
You should now be able to run your Web Project again.