Scaffolding razorpages fails when Model filename ends in "Program"
- Dominant language
- C#
- Stars
- 818
- Forks
- 260
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 10
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
When running the dotnet-aspnet-codegenerator utility, generator fails when the model used ends with the word "Program".
For example:
I have a model called DiplomaProgram.cs
If I run:
dotnet-aspnet-codegenerator razorpage -m DiplomaProgram -dc ExampleContext -udl -outDir Pages/DiplomaPrograms --referenceScriptLibraries
An error occurs described in the exception area.
If I change the filename to anything other than a name ending in "Program", command works as expected.
### Expected Behavior
Scaffolding tool should produce the Pages based on the model
### Steps To Reproduce
_No response_
### Exceptions (if any)
Building project ...
Finding the generator 'razorpage'...
Running the generator 'razorpage'...
Sequence contains no elements
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.b__6_0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
### .NET Version
6.0.1
### Anything else?
The error is definitely tied to the fact that the model filename ends in "Program".....even if it's a compound word like "FooProgram"
Contributor guide
Assessment
This issue has not been assessed yet.