Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 333
JohnCambell Avatar asked Mar 01 '17 10:03

JohnCambell


People also ask

Is Cshtml the same as razor?

cshtml file indicates that the file is a Razor Page.

What is Cshtml file format?

cshtml extension is a C# HTML file that is used at server side by Razor Markup engine to render the webpage files to user's browser. This server side coding is similar to the standard ASP.NET page enabling dynamic web content creation on the fly as the webpage is written to the browser.


1 Answers

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

like image 148
Murat Yıldız Avatar answered Oct 14 '22 08:10

Murat Yıldız