How to resolve Microsoft.Web.Infrastructure Error in MVC?

Error Details:

Could not load file or assembly ‘Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

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.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

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 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

Documentation:

The Microsoft.Web.Infrastructure contains classes that assist in managing specific infrastructure aspects of ASP.NET web pages that use the Razor syntax. Here is the Microsoft Official Documentation regarding Microsoft.Web.Infrastructure namespace.

Resolve Microsoft.Web.Infrastructure error

I imported an ASP .Net MVC project from our office repository and when I tried to attach it to a process this error popped up. I tried each and every given solution on stackoverflow and other sites from Google and absolutely nothing worked. After scratching my head for half an hour I found the reason for this weird error. My laptop machine had ASP .Net MVC 5 installed on it but the project was developed using MVC 4. To see which version of MVC is used to develop the project, go to your project’s references folder and locate System.Web.Mvc. Right click on it and check the version of it.

 ASP .Net MVC Version used in Project
Check ASP .Net MVC Version used in Project

This error might be popping because your machine may also be missing the version required for the project. In my case I was missing MVC 4. So I simply downloaded ASP .Net MVC 4 Standalone version and installed it and the error was gone. I hope this will solves your problem too. If it does, please comment to let me know. Thanks for reading. Happy Coding.

Leave a Reply