Using dash/hyphen in Razor Page filename - does co

2019-09-16 19:33发布

问题:

There seems to be an issue with the Razor Pages (2.1.0-preview1-007211) and IntelliSense in Visual Studio 2017 (15.4.0 preview 2.0) with the filenames containing dashes.

In order to reproduce:

  • Create a new razor page e.g. razorpagetest.cshtml
  • In the code add

    @{
       ViewData["Title"] = "Test123";
    }
    
  • Save and close the file

  • Rename razorpagetest.cshtml to razor-pagetest.cshtml
  • Save and close the file
  • Reopen the file and you will see errors on the errors list (although it builds OK)

Has anyone experienced this issues? Are there any workarounds?