none
mkdir hello;cd hello dotnet new console
vim hello.csproj <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp2.0</TargetFramework> <!--C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.platforms\2.0.0\runtime.json--> <RuntimeIdentifier>win10-x64</RuntimeIdentifier> </PropertyGroup> </Project>
dotnet restore dotnet publish -c release
第一次运行可能需要一段时间,需要从Nuget还原一些数据,时间较长,需耐心等待。
亲测可以跨平台编译,编译后选择发布即可。然后...发现发布的目录下全部文件大小有60多M,就一个hello word程序哦!庆幸的是在目标平台运行的时候不需要再安装dotnet core 2.0的环境了。由于我是在linux环境下运行的,所以额外运行了"yum install libunwind libicu -y",安装了两个依赖库。
如果这篇文章对你有所帮助,可以通过下边的“打赏”功能进行小额的打赏。
本网站部分内容来源于互联网,如有侵犯版权请来信告知,我们将立即处理。