. 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:
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