How to fix error "Could not load file or assembly 'Microsoft.VisualStudio.Web" in Visual Studio 2015?
There can be multiple steps / things you have to do for solving this issue:
Step 1: First Check C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
It looks to add a line under:
<system.web> (not the section under <location allowOverride="true">)
<compilation>
<assemblies>
.....
<add assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
.....
</assemblies>
There was already a <remove ... /> for this assembly at the top of that section for mine, but the add was near the bottom. Just comment this entry, and it should start working. Or if you are unsure about removing it for all websites, you could add the same line in your website web.config, with remove instead of add.
Step 2: (if you are using VS 2019) Reinstall "AspNetDiagnosticPack.msi" can solve the problem. There will be a file in the package installation folder of the VS 2019 Installation. (The checkbox for "not delete" install packages was activated*).
If you don't have the packages, that maybe a offline installation helps.
In my case the folder was named: "Microsoft.VisualStudio.AspNetDiagnosticPack.Msi,version=16.0.12276.43788".
Richt click on "AspNetDiagnosticPack" and select "repair".
Step 3: You need to download this MSI And execute it and select repair.
Finally, if any of above steps not solved the issue you need to download and install this new Visual Studio release in which this issue has been resolved.
This kind of error may occur when you install visual studio newly and try to open existing project from source control or local machine. I faced same issue couple of time, I used Clean MEF component cache to fix this issue.
Clear MEF component extension in visual studio clears the MEF cache on disk and lets Visual Studio rebuild it. The reason for clearing the MEF cache is that it can become corrupted. This usually happens when installing or updating extensions or other Visual Studio components. If still error persist then check compatibility of your project like, x64/x86 otherwise keep as any CPU.
Steps:
Install Clear MEF component cache extension from market place or from visual studio. Click Here; MEF component
After installation go to Tools -> Clear MEF component cache and press OK.
- It will restart visual studio. If still error persist then check your CPU compatibility.
Did you try opening the project under Administrator mode.