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

8

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!

c#
asp.net
visual-studio
visual-studio-2015
asked on Stack Overflow Oct 29, 2017 by 5377037 • edited Oct 31, 2017 by 5377037

11 Answers

4

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.

answered on Stack Overflow Jul 4, 2020 by Victor Benvenuto
3

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.
answered on Stack Overflow Nov 7, 2017 by Prasad Telkikar
3

Did you try opening the project under Administrator mode.

answered on Stack Overflow Nov 8, 2017 by Jineesh Uvantavida
3

Since you can't create a new web project you most certainly are having an issue with visual studios. You are certainly best off to completely uninstall and reinstall Visual Studio. If the problem persists it may be that Microsoft.VisualStudio.Web is corrupted in the GAC.

If you can replace it with a known good copy that would be worth a try. I'm not sure what uninstalling and installing all versions of the .NET framework would have on corrupted files in the GAC, but it may be worth a try since you don't know for certain what files are bad and if one is bad you may have others.

Good Luck!

Update: GAC is Global Assembly Cache. It's part of windows.

Here is a stackoverflow question regarding updating an assembly in the GAC.

Updating a GAC Assembly

answered on Stack Overflow Nov 8, 2017 by N-ate • edited Nov 9, 2017 by N-ate
2

I am guessing that you ended up corrupting one of the dll s provided by .net. this is merely related to your project rather it would be a problem when you try to create new solution also. I would recommend you to follow the steps described here

answered on Stack Overflow Nov 6, 2017 by Debashish Saha
2

A few things that you can try:

1.Clear your temporary asp.net files

2.Stop IIS if you are running IIS.

3.Delete all the files in this folder:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

Try to open the csproj file in notepad++;

Post the contents for me if you can. Chances are that one if the GUIDS is not being recognised as a valid type

If you have another similar csproj file backed up, try to open it in visual studio. If it opens, edit this csproj file in notepad++ or a comparetool. Specifically look at your references section. Play around with removing some sections.

answered on Stack Overflow Jul 9, 2020 by Jacobus Becker • edited Jul 9, 2020 by shivlal kumavat
1

I don't think what you are experiencing has to do with Visual Studio. It's a file system issue. Is the D drive a USB drive?

The drive is corrupted. You need to fix it using a utility like chkdsk:

chkdsk /f d:

If that doesn't fix the issue. Copy the solution to another drive and try again.

answered on Stack Overflow Nov 2, 2017 by JuanR • edited Nov 2, 2017 by JuanR
1

Just like the message says, it's corrupted.
The only thing that you probably can do is to copy all of your code in a new project.
else you could try to delete the corupted file and recreate it(check this link for more info)
VS corrupted .sln file?
This probably happened because you shut your computer down the wrong way.

I'm hoping for you that it'll work out.

answered on Stack Overflow Nov 2, 2017 by timo stevens • edited Nov 2, 2017 by timo stevens
1

You have files that are corrupt, just like the error says. Follow these steps, in order, to fix the issue:

  1. Uninstall Visual Studio 2015. If the uninstall fails or you cannot uninstall properly from Control Panel, try looking here for some tips.
  2. Scan your computer for any virus. There are plenty of free scanners, such as Malwarebytes, for example.
  3. Reinstall Visual Studio 2015 using the default settings
  4. Try to create a project and see if it works.
  5. If you still get errors about corrupted files, then it might be Windows itself that's corrupt. In this case, backup your files, format your hard drive and re-install Windows.
  6. if you still are having issues, another thing that could be wrong is a defective hard drive. Try replacing your hard drive, re-installing Windows and re-installing Visual Studio 2015.

Hopefuily one of these steps will work.

answered on Stack Overflow Nov 2, 2017 by Icemanind
1

If you have 2 or more VS installed, and u uninstall one of the version, it might have accidentally remove the dependencies.

You can try repair VS2015 and see if it helps.

answered on Stack Overflow Nov 8, 2017 by j.f.
0

If you can open this solution on another computer, then the problem is either: (a) your computer has some hardware issues, or (b) your version of visual studio is corrupted. Maybe you changed something that you didn't expect?

Anyway, your best bet is probably to just uninstall visual studio and reinstall visual studio. Probably not the answer you want to hear but sometimes nuking and starting over is the only way to go. You should only do this after determining if the solution directory is not the issue.

Before you go to the extreme, just simply try copying the folder where the solution is located to another place on disk and opening the project again. Make sure you run the project as an administrator if the project is a web project.

I would copy the folder from your drive to a USB drive and then try another machine that has visual studio installed. If that is your only machine I am willing to assist. Feel free to PM me and I can try opening your solution on my machine and let you know if there's something wrong with your solution file or project file.

answered on Stack Overflow Jul 11, 2020 by cr1pto

User contributions licensed under CC BY-SA 3.0