Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix error "Could not load file or assembly 'Microsoft.VisualStudio.Web" in Visual Studio 2015?

I'm working on a project while the project is working fine.

But after re-installed the Visual Studio my project is not loading.

Giving this error:

D:\UOSGC\Final\Banquet_Events_System\UI\UI.csproj :

error : Could not load file or assembly 'Microsoft.VisualStudio.Web, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The file or directory is corrupted and unreadable. (Exception from HRESULT: 0x80070570)

Error screenshot is:

enter image description here

My operating system is Windows 10 Professional and I'm using Visual Studio 2015.


Edit: When I create a new project it's not creating it and showing this error:

The file or directory is corrupted and unreadable

enter image description here

Any help will be appreciated!

like image 381
stefan Avatar asked Oct 29 '17 18:10

stefan


2 Answers

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.

like image 156
Victor Benvenuto Avatar answered Oct 03 '22 09:10

Victor Benvenuto


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:

  1. Install Clear MEF component cache extension from market place or from visual studio. Click Here; MEF component

  2. After installation go to Tools -> Clear MEF component cache and press OK.

  3. It will restart visual studio. If still error persist then check your CPU compatibility.
like image 27
Prasad Telkikar Avatar answered Oct 03 '22 11:10

Prasad Telkikar