1.一般在windows pc上使用vscode 开发好.netcore 程序如果需要发布到其他平台需要注意一些事情

首先需要明白2个概念:FDD(Framework-dependent deployment)和 SCD (Self-contained deployment)

2.# FDD

Framework-dependent deployment. As the name implies, framework-dependent deployment (FDD) relies on the presence of a shared system-wide version of .NET Core on the target system. Because .NET Core is already present, your app is also portable between installations of .NET Core. Your app contains only its own code and any third-party dependencies that are outside of the .NET Core libraries. FDDs contain .dll files that can be launched by using the dotnet utility from the command line. For example, dotnet app.dll runs an application named app.
3.#

SCD 
Self-contained deployment. Unlike FDD, a self-contained deployment (SCD) doesn't rely on the presence of shared components on the target system. All components, including both the .NET Core libraries and the .NET Core runtime, are included with the application and are isolated from other .NET Core applications. SCDs include an executable (such as app.exe on Windows platforms for an application named app), which is a renamed version of the platform-specific .NET Core host, and a .dll file (such as app.dll), which is the actual application.
参考:https://docs.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli
4.# RIDs

Windows RIDs
Windows 7 / Windows Server 2008 R2
win7-x64
win7-x86
Windows 8 / Windows Server 2012
win8-x64
win8-x86
win8-arm
Windows 8.1 / Windows Server 2012 R2
win81-x64
win81-x86
win81-arm
Windows 10 / Windows Server 2016
win10-x64
win10-x86
win10-arm
win10-arm64
Linux RIDs
Red Hat Enterprise Linux
rhel.7-x64
Ubuntu
ubuntu.14.04-x64
ubuntu.14.10-x64
ubuntu.15.04-x64
ubuntu.15.10-x64
ubuntu.16.04-x64
ubuntu.16.10-x64
CentOS
centos.7-x64
Debian
debian.8-x64
Fedora
fedora.23-x64
fedora.24-x64
OpenSUSE
opensuse.13.2-x64
opensuse.42.1-x64
Oracle Linux
ol.7-x64
ol.7.0-x64
ol.7.1-x64
ol.7.2-x64
Currently supported Ubuntu derivatives
linuxmint.17-x64
linuxmint.17.1-x64
linuxmint.17.2-x64
linuxmint.17.3-x64
linuxmint.18-x64
1
OS X RIDs
osx.10.10-x64
osx.10.11-x64
5.# 修改 .csproj 项目文件

<RuntimeIdentifiers>win7-x64;centos.-x64</RuntimeIdentifiers>

完整如下图:

6.# 直接执行 build 如果依赖项目较多可能会等很久

先执行 dotnet restore 命令

这样会下载安装一些依赖项目等完成后

再执行 build 命令

测试下在 windows 下是 ok 的

最后执行publish 指令:

dotnet publish -c Release -r centos.-x64

最后会生成Release版本:

最后生成文件非常多:

下一步使用FTP工具上传到 CentOS publish 目录:

最后一步使用 putty 命令执行就可以了

dotnet xxx.dll

--------------------------------------------------------------------------------------------------------------

注意事项 以上是基于 FDD模式 (感觉4G技术 娃哈哈哈哈)

要提前手工安装 .netcore 2.0 SDK

参考命令如下:

# 解压安装文件
$ tar -xzf ~/dotnet/dotnet-dev-centos-x64.1.0.-preview1-.tar.gz
# 软连接
ln -s /home/jake/leak/dotnet/dotnet /usr/local/bin
# 删除软连接
rm -rf /usr/local/bin/dotnet
# 查看版本
dotnet --version

.netcore2.0 发布CentOS7的更多相关文章

  1. 创建一个netcore2.0和angular的项目并运行起来

    netcore2.0发布了,喜大普奔. 我们先下载SDK,请看张善友老师的这篇博客 http://www.cnblogs.com/shanyou/p/7363037.html 下载完之后 我用的vs2 ...

  2. Centos7 部署.netCore2.0项目

    最近在学习.netCore2.0,学习了在Centos上部署.netCore的方法,中间遇到过坑,特意贴出来供大家分享,在此我只是简单的在CentOS上运行.NETCore网站,没有运用到nginx等 ...

  3. 02、NetCore2.0优化之Nuget包

    02.NetCore2.0优化之Nuget包 在NetCore2.0中的包是如何管理的?如何存储的?微软做了哪些优化工作? -------------------------------------- ...

  4. Visual Studio Code 1.0发布,支持中文在内9种语言

    Visual Studio Code 1.0发布,支持中文在内的9种语言:Simplified Chinese, Traditional Chinese, French, German, Italia ...

  5. Apache Flume 1.7.0 发布,日志服务器

    Apache Flume 1.7.0 发布了,Flume 是一个分布式.可靠和高可用的服务,用于收集.聚合以及移动大量日志数据,使用一个简单灵活的架构,就流数据模型.这是一个可靠.容错的服务. 本次更 ...

  6. Percona Server 5.6.33-79.0 发布

    Percona Server 5.6.33-79.0 发布了,该版本基于 MySQL 5.6.33,包含了所有的 bug 修复,是Percona Server 5.6 系列中的正式版本.该版本主要是修 ...

  7. Rubinius 2.0 发布,Ruby 虚拟机

    Rubinius 2.0 发布了,官方发行说明请看这里. Rubinius是一个运行Ruby程序的虚拟机,其带有Ruby的核心库. Rubinius的设计决定了其调试功能的强大,使得在运行时常规的Ru ...

  8. Restful.Data v2.0发布,谢谢你们的支持和鼓励

    v1.0发布后,承蒙各位博友们的热心关注,也给我不少意见和建议,在此我真诚的感谢 @冰麟轻武 等朋友,你们的支持和鼓励,是这个开源项目最大的推动力. v2.0在除了细枝末节外,在功能上主要做了一下更新 ...

  9. 网页动物园2.0发布,经过几个月的努力,采用JAVA编写!

    网页动物园2.0发布,经过几个月的努力,采用JAVA编写! 网页动物园2.0 正式发布!游戏发布 游戏名称: 网页动物园插件 游戏来源: 原创插件 适用版本: Discuz! X1.5 - X3.5 ...

随机推荐

  1. NGrinder操作指南

    一.使用nGrinder谷歌插件录制性能测试脚本: 1.下载录制插件压缩包ngrinder-recorder-1.0.7z,解压到本地目录. 2.打开Chrome浏览器,URL框内输入chrome:/ ...

  2. 点击隐藏显示和点击body空白处隐藏

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. kvm虚拟机磁盘文件读取小结

    kvm虚拟机磁盘挂载还真不是一帆风顺的.xen虚拟化默认就raw格式的磁盘,可以直接挂载,kvm如果采用raw也可以直接挂载,与xen磁盘挂载方式一致. 1.kvm虚拟化相比xen虚拟化来说,工具与方 ...

  4. “全栈2019”Java第七十三章:外部类里多个静态非静态内部类详解

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  5. jqury动画,循环

    一.动画 效果就是定义一个小盒子,让这个小盒子以动画的形式变化尺寸, <!DOCTYPE html> <html lang="en"> <head&g ...

  6. linux校验时间

      一. 基本方法:date -s "2018-09-02 04:23:45"clock -w 把时间写入cmos(一个RAM芯片) hwclock 查看硬件时间 hwclock ...

  7. Postman使用手册4——API test

    一.Pre Request Scripts Postman v0.10+ 版本支持pre-request scripts. prerequest script.png pre-request scri ...

  8. leetcode-137-Single Number II-第一种解法

    题目描述: Given an array of integers, every element appears three times except for one, which appears ex ...

  9. 2016级算法第五次上机-B.Bamboo&APTX4844魔发药水

    Bamboo&APTX4844魔发药水 题意 "于是,Bamboo耐着性子,看巫师从袖子里掏出 M 瓶时光泉水和 K 粒绿色能量.每瓶时光泉水重量为 c ,生发效果为 l:每粒绿色能 ...

  10. AXI协议(一)

    最近弄Zynq,不懂AXI协议Zynq很难玩儿的转.这些笔记主要攻克AXI中的一些难题. 所有的AXI4包含了5个不同的通道:     (1)读/写地址通道(Read/Write address ch ...