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. RabbitMq初探——php的一个demo

    <?php /** * Created by PhpStorm. * Date: 2017/10/17 * Time: 16:21 */ class Rabbit { public functi ...

  2. linux LVM 磁盘管理

    一.linux LVM 管理及创建步骤 步骤:1.创建pv—2.创建vg—3.将pv加入vg—4.在vg中创建lv—5.将lv分区格式化—6.将lv分区挂载到某个目录使用 1.创建PV [root@z ...

  3. 6.iptables常用规则

    开启ip段192.168.1.0/24端的80口 开启ip段211.123.16.123/24端ip段的80口 # iptables -I INPUT -p tcp --dport 80 -j DRO ...

  4. sonar阻断级别错误(block)简单汇总

    1.代码里面包含PASSWORD.PWD 'PWD' detected in this expression, review this potentially hardcoded credential ...

  5. Connection Timeout和Command Timeout

    每次对数据库连接时,我们有时候会碰到连接超时或者命令超时,这两个超时是不一样的.以ADO.NET为例,当客户端和服务器端连接时,碰到的超时情况主要有下面几种: 当从连接池获取一个连接时,碰到超时. 当 ...

  6. Deeplearning学习

    Deeplearning 概念 Deep Learning:   观点: 认为AI是最新的电力,大约在一百年前,我们社会的电气化改变了每个主要行业,从交通运输行业到制造业.医疗保健.通讯等方面,我认为 ...

  7. scrapy连接MongoDB

    Scrapy中连接MongoDB所需要做的工作如下: 1.settings中需要设置的部分: # 启动管道组件 ITEM_PIPELINES = { 'QianChengWuYu.mongoDBPip ...

  8. 对cors的理解

    一.简介 CORS需要浏览器和服务器同时支持.目前,所有浏览器都支持该功能,IE浏览器不能低于IE10. 整个CORS通信过程,都是浏览器自动完成,不需要用户参与.对于开发者来说,CORS通信与同源的 ...

  9. 如何解决 “invalid resource directory name”, resource “crunch”

    Ant and the ADT Plugin for Eclipse are packing the .apk file in a different build chain and temp gen ...

  10. JavaScript DOM编程艺术 笔记(一)

    探测浏览器品牌版本代码-----浏览器嗅探 代码 JavaScript==ECMAScript java几乎可以部署在任何环境,js只应用于web浏览器 API是一组得到各方面共同认同的基本约定(元素 ...