In Visual Studio 2022, the following error message is sometimes generated when scaffolding a controller:
If the .NET Framework project and item templates are not installed, the error mentioned earlier will occur.
How to address the problem:
Run the Visual Studio Installer
Select Modify
In the right-side tab expand ASP.NET and web development
Check .Net Framework project and item templates
Note: If the error reoccur, update the NuGet packages installed, then re-try the scaffolding.
Thanks for reading...
Happy Coding!