在 .Net 6 中,控制器 class 未显示。取而代之的是一个选项,可以将它变成 HomeController。这是更新吗?

In .Net 6, Controller class is not showing up. Instead an option is given to turn it into HomeController. Is this an update?

如图所示。我无法使用控制器 class 作为我的 HomeController.

的基础 class

是否有任何更新或我应该将其更改为其他基本控制器?

您的命名空间以 .Controller 结尾。这使编译器无法理解 class 它想要使用的内容。重命名您的命名空间并重试。

将您的文件夹名称从 Controller 更改为 Controllers,然后将命名空间从 EmployeeManagement.ControllerEmployeeManagement.Controllers。您的文件夹名称与 Microsoft.AspNetCore.Mvc.Controller 冲突。