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. 【05】循序渐进学 docker:系统资源和网络

    写在前面的话 在上一篇学习 Dockerfile 的时候其实还有几个相当重要得关键中没有谈到,但没关系,在后面的内容会单独提出来一个一个的学习.这里就先谈谈关于资源的控制个容器的网络~ 资源限制 其实 ...

  2. 1.Java Spring MVC入门 安装

    Spring 下载地址: 4.3.6.RELEASE/ 25-Jan-2017 14:05 - http://repo.spring.io/release/org/springframework/sp ...

  3. 前端-chromeF12 谷歌开发者工具详解 Network篇

    开发者工具初步介绍 chrome开发者工具最常用的四个功能模块: Elements:主要用来查看前面界面的html的Dom结构,和修改css的样式.css可以即时修改,即使显示.大大方便了开发者调试页 ...

  4. C# - 操作大型XML文件

    对于小型XML文件,利用XDocument和XMLDocument可以很方便进行读写(推荐XDocument),但问题是XDocument和XMLDocument是In-Memory类型的,随着文件大 ...

  5. leetcode-824-Goat Latin(字符串的处理)

    题目描述: A sentence S is given, composed of words separated by spaces. Each word consists of lowercase ...

  6. leetcode-575-Distribute Candies(计算一个数组中元素的种类的快速方法)

    题目描述: Given an integer array with even length, where different numbers in this array represent diffe ...

  7. 什么是hive

    Hadoop Hive概念学习系列之什么是Hive? 参考  <Hadoop大数据分析与挖掘实战>的在线电子书阅读                   http://yuedu.baidu ...

  8. selenium(python)登录时账号密码错误提示语

    selenium(python)登录时账号密码错误提示语的获取 可以用text

  9. requests库的使用

     requests库的使用 pip快速安装 pip install requests 请求方法 每一个请求方法都有一个对应的API,比如GET请求就可以使用get()方法: import reques ...

  10. P4027 [NOI2007]货币兑换

    传送门 首先有一个显然的贪心,每次操作都要做到底,为了最优不会出现只卖一部分或者只买一部分的操作 所以设 $f[i]$ 表示前 $i$ 天得到的最大价值,那么对于每一个 $i$,枚举所有 $j< ...