0
I created an empty Asp.Net Core 2.0 project (no scaffold). DDD model and etc. However when I try to create my controller, whether 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 above example I tried to create an Apicontroller and came as above.
At core he inherits only
Controller
. You didn’t accidentally create somenamespace
Controller?– Barbetta
Change the folder name to Controllers and namespace to Controllers
– Netinho Santos
@Netinhosantos, answers that I mark. It was the name of the same folder.
– pnet
@pnet responded. Att.
– Netinho Santos
Just down lately, all right. It was a few days without opening the site that is now just down, although there is a guy on the site who always gives me Downvote, regardless of the construction of the question, but this is another subject.
– pnet
See also the ASP NET Core 2 Razor Pages, which further simplifies this.
– Tony
thanks @Tony, I’ll give a study yes
– pnet