Search code examples
asp.net-mvcvisual-studioasp.net-mvc-4razorvisual-studio-2015

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.


Solution

  • 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.