AspNetCore.Docs/aspnetcore/tutorials/first-mvc-app/adding-controller.md

1.0 KiB

title author description ms.author ms.date uid
Add a controller to an ASP.NET Core MVC app rick-anderson Learn how to add a controller to a simple ASP.NET Core MVC app. riande 02/28/2017 tutorials/first-mvc-app/adding-controller

Add a controller to an ASP.NET Core MVC app

By Rick Anderson

[!INCLUDE adding-controller1]

  • In Solution Explorer, right-click Controllers > Add > New Item

Contextual menu

  • Select Controller Class
  • In the Add New Item dialog, enter HelloWorldController.

Add MVC controller and name it

[!INCLUDE adding-controller2]

In Visual Studio, in non-debug mode (Ctrl+F5), you don't need to build the app after changing code. Just save the file, refresh your browser and you can see the changes.

[!div class="step-by-step"] Previous Next