简体   繁体   中英

VS2015 Not able to edit cshtml files

Since yesterday I'm not able to edit cshtml files. Each time I try to edit a cshtml file I get the following message:

"The document cannot be opened. It has been renamed, deleted or moved."

It all started when trying to fix an issue with TypeScript not saving on compile. As nothing seemed to work I noticed the update to a .Net SDK (DotNetCore.1.0.1-VS2015Tools.Preview2.0.3.exe). The install took a long time and I eventually cancelled it. Since then I can't edit any cshtml files.

I created a new mvc project to see if I can edit cshtml files there, but it also doesn't work.

I tried everything I could find apart from a complete re-install but nothing seems to fix it. I saw the discussion on https://github.com/aspnet/Tooling/issues/390 but none of the suggestions helped.

Follow below steps to resolve this issue:

  1. In the Individual components section of the Visual Studio Installer, make sure that Razor Language Services is checked.
  2. After installation, make sure that Razor Language Services is enabled in the Installed section of Tools > Extensions and Updates dialog.
  3. Restart Visual Studio.

Reference: https://developercommunity.visualstudio.com/content/problem/194267/the-document-cannot-be-opened-it-has-been-renamed.html

Try to clean the contents in the following cache folders ( do not delete these folders, instead delete their contents only ) and restart Visual Studio :

  • Clean the content in WebSiteCache folder (can be found in
    C:\\Users\\%USERNAME%\\AppData\\Local\\Microsoft\\WebSiteCache )

  • Clean the content in Temporary ASP.NET Files folder (can be found in
    C:\\Users\\%USERNAME%\\AppData\\Local\\Temp\\Temporary ASP.NET Files )

And then restart Visual Studio. If the problem continues you might try to rename the project folder and reopen it again. Hope this helps...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM