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

29 lines
928 B
Markdown
Raw Normal View History

---
2017-07-01 07:47:15 +08:00
title: Adding a controller
2018-01-29 23:21:31 +08:00
author: rick-anderson
description: How to add a controller to a simple ASP.NET Core MVC app
manager: wpickett
2018-01-29 23:21:31 +08:00
ms.author: riande
ms.date: 02/28/2017
ms.prod: asp.net-core
2018-01-29 23:21:31 +08:00
ms.technology: aspnet
ms.topic: get-started-article
uid: tutorials/first-mvc-app-xplat/adding-controller
---
# Adding a controller to an ASP.NET Core MVC app with Visual Studio Code
By [Rick Anderson](https://twitter.com/RickAndMSFT)
[!INCLUDE[adding-controller](../../includes/mvc-intro/adding-controller1.md)]
* In **VS Code**, select the **EXPLORER** icon and then control-click (right-click) **Controllers > New File** and name the new file HelloWorldController.cs.
![Contextual menu](adding-controller/_static/new_file.png)
[!INCLUDE[adding-controller2](../../includes/mvc-intro/adding-controller2.md)]
>[!div class="step-by-step"]
2017-04-15 01:46:51 +08:00
[Previous - Add a controller](start-mvc.md)
2017-06-23 05:27:28 +08:00
[Next - Add a view](adding-view.md)