官术网_书友最值得收藏!

Creating your first ASP.NET Core 2.0 application in Visual Studio 2017

You have patiently read the previous chapters, understood what you will be learning by reading this book, and prepared your developer machine. You are now ready to create your first sample application.

Let's look at the different options you have for creating your first ASP.NET Core 2.0 application in more detail.

When creating a new project in Visual Studio 2017, the first thing you see is the template explorer displaying a tree view for choosing between installed, language-specific, and online templates.

After having selected the template source in the tree view, the different templates are shown. For ASP.NET Core, you see Console App, Class Library, Unit Test Project, xUnit Test Project, and ASP.NET Core Web Application (.NET Core), for example.

Since some of the templates integrate multiple application types, you sometimes have to make additional choices to specify what exact type of application you want to create. This is the case for ASP.NET Core web applications, since you have to choose between an empty, Web API, Web Application, or Web Application (Razor Pages) project template. Additionally, you can enable Docker support and change the authentication mode between no authentication, an inpidual user account, a work or school account, or Windows authentication.

The following are step-by-step instructions for creating your first ASP.NET Core 2.0 sample web application:

  1. If the .NET Core 2.0 SDK is not yet installed, then download and install .NET Core Preview 2 from https://www.microsoft.com/net/core/preview.

Note that this step might no longer be needed at the time of reading this book, since it should have been released officially by then.

  1. Start Visual Studio 2017.
  2. Create a new project by clicking on File | New | Project:
  1. Select as project template Visual C# | .NET Core | ASP.NET Core Web Application (.NET Core):
  1. You are now able to select the specific web application type. Select Web Application (Razor Pages) and leave the Docker support (disabled) and authentication (No Authentication) options unchanged:

Note that at the time of the elaboration of this book, only Visual Studio 2017 Preview 15.3 had support for ASP.NET Core 2.0. It should be included in the standard version, though, and at the time of publication.

  1. After the sample application project has been generated, a project start page is displayed. Here, you can configure additional options such as connected services (Application Insights, and more) and publishing targets (Microsoft Azure App Services, IIS, FTP, Folder, and more). Leave everything unchanged:
  1. You can now start debugging your application by pressing F5 or by clicking on Debug | Start Debugging:
主站蜘蛛池模板: 定陶县| 利津县| 瑞丽市| 甘谷县| 黔江区| 东至县| 新宁县| 土默特左旗| 宁城县| 文山县| 镇沅| 竹溪县| 白银市| 神池县| 舞钢市| 桂平市| 罗江县| 津南区| 武邑县| 福建省| 宜章县| 饶阳县| 邢台市| 株洲市| 潜江市| 开江县| 五华县| 保康县| 贵港市| 光泽县| 嘉善县| 调兵山市| 碌曲县| 琼结县| 洛宁县| 都兰县| 出国| 伊宁县| 遵义市| 淄博市| 延川县|