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

1.2 KiB

title author description keywords ms.author manager ms.date ms.topic ms.assetid ms.technology ms.prod uid
Adding a controller | Microsoft Docs rick-anderson How to add a controller to a simple ASP.NET Core MVC app ASP.NET Core, MVC riande wpickett 02/28/2017 get-started-article e04b6665-d0de-4d99-b78f-d6a0c4634a87 aspnet asp.net-core tutorials/first-mvc-app/adding-controller

Adding a controller to a ASP.NET COre MVC app with Visual Studio

By Rick Anderson

[!INCLUDEadding-controller1]

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

Contextual menu

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

Add MVC controller and name it

[!INCLUDEadding-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