ASP. NET Core and asp. netcore

Source: Internet
Author: User

ASP. NET Core and asp. netcore

Step 1: run the dotnet restore command to restore the specified dependency in the project

1 dotnet restore

Step 2: Use the dotnet build command to create a debugging version for the application on the target platform. If you do not specify the runtime identifier you want to generate, The dotnet build command creates a version that is only applicable to the current system runtime ID. Use the following command to generate applications applicable to the Target Platform:

1 dotnet build -r win81-x64

My Server is Windows 8.1/Windows Server 2012 R2
Win81-x64
Win81-x86
Win81-arm

Target Platform. NET Core runtime identifier (RID) Directory

NOTE: If it fails, a message similar to the following is displayed:

C: \ Program Files \ dotnet \ sdk \ 1.0.0 \ Sdks \ Microsoft. NET. sdk \ build \ Microsoft.NET.Sdk.tar gets (92,5): error: Assets file 'd: \ Site \ GCClass4 \ obj \ project. assets. json 'doesn' t have a target '. NETCoreApp, Version = v1.0/win81-x64 '. ensure you have restored this project for TargetFramework = 'netcoreapp1. 0 'and RuntimeIdentifier = 'win81-x64 '. [D: \ Site \ GCClass4 \ GCClass4.csproj]

Modify Your. csproj file as follows:

 1 <Project Sdk="Microsoft.NET.Sdk.Web"> 2   <PropertyGroup> 3     <TargetFramework>netcoreapp1.0</TargetFramework> 4     <RuntimeIdentifiers>win81-x64</RuntimeIdentifiers> 5   </PropertyGroup> 6   <ItemGroup> 7     <PackageReference Include="Microsoft.AspNetCore" Version="1.0.3" /> 8     <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.2" /> 9     <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.1" />10     <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.1" />11     <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" />12   </ItemGroup>13 </Project>

Execute Step 1 and Step 2 again.

Step 3: After debugging and testing the program, you can use the dotnet publish command on the two target platforms to create a file to be deployed with the application for each target platform, as shown below:

1 dotnet publish -c release -r win81-x64

-C configuration used for release. The default value is Debug.

-R releases an application for a given runtime. For a list of available runtime Identifiers (RID), see the RID directory.

This will create an application release (instead of a debug version) for the target platform ). The generated file is located in the subdirectory named publish, which is located in the subdirectory of the Project. \ bin \ release \ netcoreapp1.0 \ <runtime_identifier>. Note that each subdirectory contains the complete file set (both application files and all. NET Core files) required to start the application ).

 

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.