Recently, I ran into issues while writing an ASP.NET 4.0 application. I tried to remember if I had meddled with anything or deleted any components by mistake.
This was the error I get when trying to compile my application:
Could not load file or assembly 'Microsoft.VisualStudio.Web.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Below is the exception message seen in the browser:
Server Error in '/WebSite4' Application. Stack Trace: [FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] [ConfigurationErrorsException: Could not load file or assembly 'Microsoft.VisualStudio.Web.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] [HttpException (0x80004005): Could not load file or assembly 'Microsoft.VisualStudio.Web.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.] |
I couldn’t remember doing any such destructive activity.
I tried a couple of troubleshooting steps, I changed the target framework to .NET 3.5 and I was able to compile my application successfully. So, obviously the issue was with ASP.NET 4.0 applications only.
I started searching forums to see if someone had encountered this issue. Looks like I was not the only one.
Seems the issue was due to a component called “Microsoft Page Inpector - Visual Studio vNext”
Forum Link: http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/92823976-be85-43af-9efa-6b28f441fd6b/
Supposedly, Page Inspector on Visual Studio 2010 (RTM or SP1) will cause this problem. Page Inspector is only supported on the Visual Studio 11 Developer Preview, because it requires new components that only exist in ASP.NET 4.5.
Page Inspector's installer is supposed to block if you don't have the Developer Preview installed, but apparently that's not happening. I remember installing this component via Web Platform installer.
Don’t ask me the reason why I installed it, I just did it.
So, the resolution was to uninstall this component.
- Go to "Programs and Features"
- Type "Page Inspector" and bingo, this would list it. It is listed as "Microsoft Page Inspector - Visual Studio vNext"
- Uninstall the component.
As soon as I uninstalled the component, the error went away. Relief!
Out of curiosity, I tried installing it again via the Web Platform Installer, looks like it does prompt the user for a warning message before installing it.
I wonder if this prompt was thrown earlier. Anyways, this is fixed for now.
Until then, CYA