Error trying to create a Controller or ApiController

0

I created an empty Asp.Net Core 2.0 project (without scaffold). Model DDD and etc. But when I try to create my controller, it is inherited from ApiController or Controller, it gives error:

  

Controller is a namespace, but is used as a type

[Produces("application/json")]
[Route("api/Message")]
public class MessageController : Controller
{
}

In the example above I tried to create an ApiController and it came as above.

    
asked by anonymous 18.06.2018 / 16:56

1 answer

2

Change the folder name for Controllers and namespace to Controllers.

namespace MeuApp.Controllers
{
   public class MessageController : Controller
   {
       // Seu código...
   }
}
    
18.06.2018 / 17:06