none
Problem opening .cshtml files

    Question

  • Hello,

    So the past few days I've been learning ASP.NET core MVC. The first few projects worked just like expected, nothing special. Yesterday, I started a new project, still following everything the tutorial said, but I couldn't open any .cshtml files. I tested it in different situations, but I can't open them even if it's a completely new project with nothing modified, and now I can't open them even in previous projects that were working fine a few days ago.

    So I have no idea what could have happened yesterday that made Visual Studio go stupid.

    The error it says when I try to open one is this: "The document cannot be opened. It has been renamed, deleted or moved".

    Now I can assure you, none of that is true. Every other program, like Sublime or Webmatrix, can open the files without any problems.

    Yesterday, nothing worked in Visual Studio, every project had a compile error.

    So any help is appreciated. Any suggestions?

    Thank you in advance

    Saturday, April 15, 2017 7:47 AM

All replies

  • Hi Spartai,

    Welcome to MSDN forum.

    What is the version of your Visual Studio? It`s works fine for me with Visual Studio 2015 update 3. Since we could not sure the reason for this issue, I would like give you some troubleshootings to resolve this issue:

    1. Running visual studio as a administrator.

    2. Check if you have install any other extension, for example, Xamarin. Please open an administrative CMD window and navigate to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE and run the command: devenv /safemode, if it works and it looks like this issue caused by the extensions, you need to deactivated that extension.

    3. If this issue still persist, please try to repair or reinstall your Visual Studio, check if it works fine.

    Hope this can help you. 


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 17, 2017 10:14 AM
  • Well, I did nothing, so without any reason it started generating that error, but just like that, without me doing anything, it started working again today.

    So it's working now, but I don't know how it solved the previous error by itself.

    I updated Visual Studio just in case though

    Thank you for your answer anyway

    Monday, April 17, 2017 9:38 PM
  • @Spartai, I'm so glad to hear that your issue is solved and thank you for your reply. Since this issue no longer occurs after update Visual Studio, one possible reason is that the update has resolved this issue.

    Since it works well now, if possible, you can mark your reply as the temporary answer, so it could help other community members who meet the same issue, and then we could close this case for you. Of course, if you meet any VS IDE issue, welcome to this forum.



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 18, 2017 5:00 AM