This post was most recently updated on January 7th, 2019.
This post describes how to fix the “Could not load file or assembly ‘[assemblyname]’ or one of its dependencies. An attempt was made to load a program with an incorrect format.” error.
Especially while installing a new dev machine, and building your project for the first time, you may end up getting the following exception:
Could not load file or assembly '[assemblyname]' or one of its dependencies. An attempt was made to load a program with an incorrect format.
No fear, though, as this is usually easily fixed. In quite a few cases, it’s simply a mismatch between architectures and easily changed.
The latter part of the error message should point you
By default, Visual Studio uses 32-bit version of IIS Express for your deployments. In case you know what you’re doing, it’s safe and easy to change this, though. If you’re building your solution in x64, running it in 32-bit IIS Express won’t work.
In my case, I was building a 64-bit application. Therefore I also had to change the IIS to run in
Solution: Change the IIS Express to run in 64b
Okay – see the steps below.
How to change IIS Express to run in 64-bit
- You’ll need to enable 64-bit IIS Express from VS settings:
- Navigate to Visual Studio – Tools – Options – Projects and Solutions – Web Projects
- Select “Use the
64 bitversion of IIS Express for web sites and projects”
- Hit “OK” to save your changes.
See the screenshot below:
And you should be golden!
He's been a developer from 2004 (starting with PHP and Java), and he's been bending and twisting SharePoint into different shapes since MOSS. Nowadays he's not only working on SharePoint, but also on .NET projects, Azure, Office 365 and a lot of other stuff.
This is his personal professional (e.g. professional, but definitely personal) blog.
Latest posts by Antti K. Koskela (see all)
- SharePoint linguistic search features - March 20, 2019
- How to remove Azure Functions without deleting the Functions App? - March 20, 2019
- EntityFramework Core 2.1 – Update-Database error “The EntityFramework package is not installed” - March 19, 2019