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

halfer
  • 19,824
  • 17
  • 99
  • 186
  • Try to create a new solution and add projects to it (probably copy projects to another folder) – Alex Kudryashev Oct 29 '17 at 19:03
  • I have tried but problem still persists. –  Oct 30 '17 at 17:16
  • I would suggest to try on another machine or reinstall Visual Studio. – Sven Nov 02 '17 at 13:31
  • You can try resetting your VS by using command line switches as per here https://msdn.microsoft.com/en-us/library/xee0c8y7.aspx and try, specifically /ResetSettings /SafeMode – Ravi A. Nov 02 '17 at 13:34
  • Try running as admin? Did you install an older build of VS perhaps? – Jacob H Nov 02 '17 at 13:39
  • @JacobH I've build it with changing in `Web.Config` settings then the issue is raised. –  Nov 02 '17 at 16:41
  • Have you tried to run the project on another machine? Does it behave in the same way? – Lavinia N. Nov 08 '17 at 18:47
  • 1
    perform this in your NuGet Install-Package Microsoft.VisualStudio.Web.BrowserLink.12.0 -Version 12.0.0.you go to the folder and right-click on the solution check the path is right or not – Bibin Jul 09 '20 at 06:02
  • @Bibin solution is not loading –  Jul 09 '20 at 11:37
  • @5377037 go to the floder right-click on the solution check the pyscial path – Bibin Jul 09 '20 at 13:11

11 Answers11

4

Did you try opening the project under Administrator mode.

3

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.

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

Debashish Saha
  • 318
  • 1
  • 12
2

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.
Prasad Telkikar
  • 15,207
  • 5
  • 21
  • 44
  • Please try it. I hope it will work otherwise I will get to know this solution won't work – Prasad Telkikar Nov 08 '17 at 06:00
  • Is this reset the **Web.config** files settings to default as problem is arises after changing the settings and then I reinstalled the VS? –  Nov 08 '17 at 06:22
  • I am not 100% sure, but it won't reset your settings in web.config file, it just resets your visual studio environment. I request you to take back up of your web.config before doing clear MEF component cache – Prasad Telkikar Nov 08 '17 at 06:24
  • the problem is arise after applying this solution see https://stackoverflow.com/questions/47000138/could-not-load-file-or-assembly-or-one-of-its-dependencies-the-file-or-di –  Nov 08 '17 at 06:27
  • Do you mean to say, when you apply "Clean MEF component cache", it is giving error mentioned in link which you pasted in last comment. MEF component cache restoring your web.config file to its default state – Prasad Telkikar Nov 08 '17 at 06:36
  • No, this error is arise after the applying the the solution mentioned in link in above comment. And I want to know; will applying "Clean MEF component cache" restore the settings to default of **Web.config** that I've changed previously. –  Nov 08 '17 at 06:45
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/158475/discussion-between-prasad-telkikar-and-asif-ali). – Prasad Telkikar Nov 08 '17 at 06:48
2

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

N-ate
  • 6,051
  • 2
  • 40
  • 48
  • Yes I think so that's the problem with .Net framework. What is GAC and how I can do it? –  Nov 09 '17 at 14:33
  • I've added a link about working with the GAC. You may want to attempt to uninstall and reinstall .NET Frameworks before working with the GAC. This can be done by going to control panel and selecting add or remove features. – N-ate Nov 09 '17 at 18:37
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.

shivlal kumavat
  • 868
  • 1
  • 12
  • 28
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.

JuanR
  • 7,405
  • 1
  • 19
  • 30
  • `chkdsk` may not be able to fix the drive errors so make sure you copy it to a different drive, not just another folder. – JuanR Nov 02 '17 at 13:37
  • I have my to projects in drives C: and D: but both are giving same issue/error. –  Nov 02 '17 at 13:38
  • Are drives C and D logical drives? They might be sitting in the same physical drive. Get a USB drive or something and copy it there. Otherwise, it might be OS corruption in which case you need to take it to another computer altogether and try there. – JuanR Nov 02 '17 at 13:40
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.

timo stevens
  • 372
  • 1
  • 3
  • 15
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.

Icemanind
  • 47,519
  • 50
  • 171
  • 296
  • I've build it with changing in **Web.Config** settings then the issue is raised. –  Nov 05 '17 at 11:52
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.

j.f.
  • 184
  • 9
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.

cr1pto
  • 539
  • 3
  • 13
  • I checked that there is issue in solution file . project file –  Jul 11 '20 at 21:16
  • Did you create a new blank solution and import the project? – cr1pto Jul 11 '20 at 21:19
  • Yes that works but my currently corrupted project is not working. –  Jul 11 '20 at 21:23
  • You can use a text editor like vs code or sublime or notepad++ and open the .sln file and edit it manually. You can use the solution file that works as a basis for the one that isn't working and then you should be able to just reimport the project in the bad one. – cr1pto Jul 11 '20 at 21:27
  • Sure thing - feel free to upvote my answer or mark the answer as a solution if you feel this is the solution. – cr1pto Jul 11 '20 at 21:36
  • 1
    I moved VS then made a backup. Somehow, it ran the VS installer from the new backup dir, so it began failing the crypto check (this error) due to being somewhere else. Installing the Installer (vs_community.exe) and re-running/launching Visual Studio from the new install was happier and extensions began installing again. So your last sentence in first paragraph. Microsoft really should fix the "moving VS to new directory" issue. It's really hard to do, and requires a registry editing for Shared, then this thing happened – Stephen J Jul 10 '21 at 07:34
  • I hate that this happens to be the solution sometimes :/ thanks Stephen – cr1pto Sep 01 '22 at 06:18