Tech Tips
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Fixing the “Could not load file or assembly … or one of its dependencies” error

Go down

Fixing the “Could not load file or assembly … or one of its dependencies” error Empty Fixing the “Could not load file or assembly … or one of its dependencies” error

Post  Admin Thu Apr 08, 2021 9:26 am

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.

The latter part of the error message should point you to the right direction. “An attempt was made to load a program with an incorrect format.” That means that the assembly, which was to be loaded, was in an unexpected format. The format, in this case, refers most likely to 64-bit build of an application being deployed to IIS, which is being run in 32-bits.

By default, Visual Studio uses 32-bit version of IIS Express (Internet Information Services Express – the free lightweight web server that ships with some Windows versions and is useful for local development with Visual Studio) 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 indeed building a 64-bit application. Therefore I also had to change the IIS to run in 64-bit version. That’s luckily quite easy!

Solution: Change the IIS Express to run in 64b


How to change IIS Express to run in 64-bit mode?
You’ll need to enable 64-bit IIS Express from VS settings
This is easy, one-click configuration change, but it is hidden quite deep in the Options.

Navigate to Visual Studio – Tools – Options – Projects and Solutions – Web Projects
Alternatively, use the search for and write “64 bit”.

Select “Use the 64 bit version of IIS Express for web sites and projects”
Fixing the “Could not load file or assembly … or one of its dependencies” error 9aa30210

Admin
Admin

Posts : 60
Join date : 2009-06-05

https://softro.forumotion.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum