A type with the name "ModelName" does not exist when creating MVC Controller with views
- Dominant language
- C#
- Stars
- 818
- Forks
- 260
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 10
Description
Trying to add a new controller using "Add MVC Controller with views, using Entity Framework" option fails with following error.
There was an error running the selected code generator:
'A type with the name __ does not exist.
The Code Generation Log is as below:
Finding the generator 'controller'...
Running the generator 'controller'...
A type with the name SportsWeek.Models.Models.Block does not exist
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)
1. The referenced Model is in a separate assembly.
2. Controller is generated fine if it is an empty MVC Controller
Microsoft.VisualStudio.Web.CodeGeneration.Design version: 6.0.0
Target framework: .NET 6.0
Operating system: Windows 11 Pro
IDE: Visual Studio Community 2022
Contributor guide
Assessment
This issue has not been assessed yet.