Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Razor Page doesn't compile when dash/hyphen used in file name #6296

Closed
mikebrind opened this issue May 19, 2017 · 2 comments
Closed

Razor Page doesn't compile when dash/hyphen used in file name #6296

mikebrind opened this issue May 19, 2017 · 2 comments

Comments

@mikebrind
Copy link

mikebrind commented May 19, 2017

If you use a dash / hyphen in a Razor Page file name, the resulting page will not compile. This is because the generated type name includes invalid characters e.g hyphen-test.cshtml becomes.

public class hyphen-test_Page : global::Microsoft.AspNetCore.Mvc.RazorPages.Page

You probably want to replace them with underscores.

@rynowak rynowak added the bug label May 19, 2017
@rynowak
Copy link
Member

rynowak commented May 19, 2017

Thanks for reporting this, we'll get it fixed.

@mehowq
Copy link

mehowq commented Sep 19, 2017

There is still (2.1.0-preview1-007211) an issue with IntelliSense 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 build OK)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

3 participants