(Optional) Run scaffold razor CRUD pages, from visual studio or from dotnet command line, and see that scaffolding works.
Undo that, and now rename the Startup class to something else and then run scaffolding again.
Now you should see the following error:
"There was an error running the selected code generator: 'Object reference not set ot an instance of an object.'
Now create a new emtpy class and simply call it Startup which is enough to make scaffolding work again.
Target framework(s):
It happens in all versions from what I can tell. 2.1.x and 2.2.x but here is one combination:
Please please please provide more details in the error message! I've spent so many hours on this one because it occurs for many different reasons it seems.
Currently, we do rely on the startup file being named "Startup.cs" for ASP.NET Core Web projects. Looking for a fix if the startup file's name is changed.
Steps to reproduce:
"There was an error running the selected code generator: 'Object reference not set ot an instance of an object.'
Target framework(s):
It happens in all versions from what I can tell. 2.1.x and 2.2.x but here is one combination:
Side note:
Please please please provide more details in the error message! I've spent so many hours on this one because it occurs for many different reasons it seems.