. NET Core 1.x 2.0 standalone deployment and Framework dependencies deployment

Source: Internet
Author: User
Tags dotnet

The. NET core 1.x deployment method is described in detail at the website Https://docs.microsoft.com/zh-cn/dotnet/core/deploying/deploy-with-vs

Or a little summary, because of the use VS more, so the VS deployment approach as an example

There is no third party dependencies do not make a difference description, anyway, after using NuGet installation will automatically modify the csproj file


The. NET core framework relies on deployment: At this point, there is no difference between 1.x and 2.0, normal generation, release




Standalone deployment: The main difference is the modification of the csproj file

First, you need to add runtimeidentifiers tags

For 1.x, fill in the content win10-x64;osx.10.11-x64

Detailed system Support List Https://docs.microsoft.com/zh-cn/dotnet/core/rid-catalog

The complete csproj file contains the following

<project sdk= "MICROSOFT.NET.SDK" >
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <runtimeidentifiers>win10-x64;o sx.10.11-x64</runtimeidentifiers>
  </PropertyGroup>
  <ItemGroup>
    < Packagereference include= "Newtonsoft.json" version= "10.0.3"/>
  </ItemGroup>
</Project>

For 2.0, fill in the content slightly different, win-x64;linux-x64;osx-x64

Complete csproj file contents are as follows

<project sdk= "MICROSOFT.NET.SDK" >

  <PropertyGroup>
    <RuntimeIdentifiers>win-x64; linux-x64;osx-x64</runtimeidentifiers>
    <OutputType>Exe</OutputType>
    < targetframework>netcoreapp2.0</targetframework>
  </PropertyGroup>

  <ItemGroup>
    <packagereference include= "Newtonsoft.json" version= "10.0.3"/>
  </ItemGroup>

</Project>

Rebuild Project after modification

Select Target platform and click Publish



You can then copy the entire output directory to the target platform host and run it.

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.