Visual Studio 2017 ASP. NET Core development, 2017 core

Source: Internet
Author: User

Visual Studio 2017 ASP. NET Core development, 2017 core

Visual Studio 2017 ASP. NET Core development, Visual Studio 2017 has built-in ASP. NET Core development tools.

After installing the. NET Core function, you can develop ASP. NET Core.

The new ASP. NET Core project is csproj. When the previous xproj project is opened, one-way upgrade will be prompted. After confirmation, it will automatically help you upgrade to csproj.

 

Create a project

VS 2017 create an ASP. NET Core project:


 

After confirmation

 

You can select ASP. NET Core 1.0 and ASP. NET Core 1.1, and enable Docker support.

The following is the project structure for enabling Docker in ASP. NET Core 1.1.


The project can run on Docker. If you want to debug Docker, you must install Docker locally.

ASP. NET Core 1.1 adds some new features. For example, WebSockets supports.

Install the Microsoft. AspNetCore. WebSockets package and add the following in the Configure method of the Startup class:

app.UseWebSockets();

For details, see the official documentation:

Https://docs.microsoft.com/en-us/aspnet/core/aspnetcore-1.1#choosing-between-versions-10-and-11-of-aspnet-core

. NET Core csproj support

In the csproj file of the project, you can note that the project reference is greatly simplified.

Right-click to edit the csproj file:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
  </ItemGroup>

</Project>

 

PackageReference: NuGet package

DotNetCliToolReference is an enhanced dotnet command line tool.

 

Publish an application

Right-click a project and choose publish from the shortcut menu. Then, select a folder.


Click to publish as follows:


You can perform specific settings in the settings following the target location.

 

Visual Studio 2017 extension is recommended.

Develop ASP. NET Core. The following two extensions are recommended for installation:

Recommended NuGet installation package for the edited csproj File: Project File Tools

Https://marketplace.visualstudio.com/items? ItemName = ms-madsk.ProjectFileTools

ASP. NET Core Tag Helpers smart prompt: Razor Language Services

Https://marketplace.visualstudio.com/items? ItemName = ms-madsk.RazorLanguageServices

You can download and install the tool from the above address, or search for the Installation Tool in tools> extensions and updates:


 

Two more VS 2017 extensions are recommended below:

Web essenessenweb development tool:

Https://marketplace.visualstudio.com/items? ItemName = MadsKristensen. WebExtensionPack2017

Productivity Power Tools 2017 efficiency development:

Https://marketplace.visualstudio.com/items? ItemName = VisualStudioProductTeam. ProductivityPowerPack2017

 

As vs7 7 is just available in the official version, there are still some problems.

Specific can go to https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes#a-idknownissues-aknown-issues to view.

If you have any problems, click in the upper right corner to send a feedback report.

 

Reference: https://blogs.msdn.microsoft.com/webdev/2017/03/07/announcing-visual-studio-2017/

 

If you think this article is helpful to you, click"Recommendation", Thank you.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.