'Controller' is namespace but is used like a type

与世无争的帅哥 提交于 2020-06-23 08:14:54

问题


When i create new controller always throw an error "Controller'] is namespace but is used like a type".I dont know how to fix it i hve install the package.enter image description here


回答1:


change the folder name to Controllers and namespace to Controllers, so your code should look like this

namespace WebApplication1.Controllers
{
   public class UserController : Controller
   {



回答2:


you have created folder name as controller that stop inherit Controller class so please change your folder name controller to controllers.

It work for me.



来源:https://stackoverflow.com/questions/48972148/controller-is-namespace-but-is-used-like-a-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!