. NET Core cross-platform release of Linux and OSX,. netcorelinuxosx

Source: Internet
Author: User

. NET Core cross-platform release of Linux and OSX,. netcorelinuxosx

 

Cross-platform Publishing

Create a project.

mkdir dotnethellocd dotnethellodotnet new

Dotnet newModify project. json as follows:

{"Version": "1.0.0-*", "buildOptions": {"emitEntryPoint": true}, "dependencies": {"Microsoft. NETCore. app ": {" type ":" platform ", // remove" version ":" 1.0.0-rc2-* "}}," frameworks ": {" netcoreapp1.0 ": {"imports": "dnxcore50" }}, "runtimes": {// Add runtime "win7-x64" :{}, "win7-x86" :{}, "osx.10.10-x64 ": {}, "osx.10.11-x64" :{}, "Ubuntu.14.04-x64 ":{}}}

Add NuGet. Config

<?xml version="1.0" encoding="utf-8"?><configuration>  <packageSources>    <clear />    <add key="AspNetCI" value="https://www.myget.org/F/aspnetcirelease/api/v3/index.json" />    <add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />  </packageSources></configuration>

Dotnet restore

After the restoration, You can compile and release it.

Windows:

Input here by defaultDotnet publishThe win7-x64 is published.

Go to the win7-x64 \ publish folder and run dotnethello.exe without installing the. netcore sdk.

 

Ubuntu:

We need to release it to linux ubuntu and directly specify the runtime.

Dotnet publish-r ubuntu.14.04-x64

Copy the release folder (ubuntu.14.04-x64/publish) to ubuntu.

You can directly execute it without installing the. netcore sdk. You only need several packages on which. netcore depends:

Https://github.com/dotnet/cli/blob/rel/1.0.0/Documentation/cli-prerequisites.md

Ubuntu distributions require the following libraries installed:

  • Libunwind8
  • Libunwind8-dev
  • Gettext
  • Libicu-dev
  • Liblttng-ust-dev
  • Libcurl4-openssl-dev
  • Libssl-dev
  • Uuid-dev
  • Unzip

Set the execution file dotnethello in the folder and set the permission directly./dotnethello

Mac OS:

Similarly, for mac OS, specify osx runtime.

Dotnet publish-r osx.10.10-x64

Copy osx.10.10-x64/publish to mac OS.

OS X requires libssl Installation

OS X requires the following libraries and versions installed:

  • Libssl 1.1

Run dotnethello

In this way, we can run the. NET Core application without installing the. NET Core SDK. Implemented cross-platform. NET Core.

 

Author of http://www.linuxidc.com/Linux/2016-07/133202.htm: linezero

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.