ASP.NET Core MVC--getting error when adding new 'Razor View - Empty"

Viewed 462

I am using Visual Studio 2019 with the latest release of the Core framework. I am creating a new Core MVC app against the Core Framework version 3.1. I have a controller and an action method. I want to create a new view. I am 'Empty' Razor View scaffolded item option. However, I get an error message as follows:

Files and Folders Cannot be

  • Empty Strings
  • System reserved names, including 'CON, 'AUX', 'PRN', 'COM1', or 'LPT2'
  • contain only '.'
  • have any of the following characters / ? : & \ | # %

Visual Studio Error Message when creating Empty View

The error occurs when selecting the option to add the view and before I ever get the dialogue box asking for the view's name.

Any ideas why I am getting this message?

1 Answers

I had the same problem. After some investigation I realized that my project folder path had a '#' in it (option 4 in the list of errors above). I created the project with a new folder path (e.g. in the c:/somepath/repos folder), which solved the error.

Related