Cross-Platform Publishing
Simply create a new project.
mkdir DOTNETHELLOCD dotnethellodotnet New
dotnet New after modifying 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 ": {//Join 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 restore, you can compile the publication.
Windows:
The default input dotnet publish will publish win7-x64 here.
We navigate to the Win7-x64\publish folder and can execute the Dotnethello.exe directly without installing the. Netcore SDK.
Ubuntu:
We want to post to Linux Ubuntu Direct designation runtime.
dotnet Publish-r ubuntu.14.04-x64
Copy the publishing folder (Ubuntu.14.04-x64/publish) to Ubuntu.
Can be executed directly without the need to install the. Netcore SDK, just. Netcore depends on several packages:
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 Execute file under folder Dotnethello set permissions directly after./dotnethello
Mac OS:
Like Mac OS, specify OSX runtime.
dotnet Publish-r osx.10.10-x64
Copy the Osx.10.10-x64/publish to Mac OS.
OS X needs to be installed Libssl
OS X requires the following libraries and versions installed:
Executive Dotnethello
This allows us to run. NET core applications without installing the. NET Core SDK. Implements the. NET Core cross-platform.
Original Http://www.linuxidc.com/Linux/2016-07/133202.htm Linezero
. NET Core Cross-platform release of Linux and OSX