CentOS7安装.NET Core运行环境

安装.NET Core

 ->首先须要删除之前安装的版本

 -> 获取安装脚本

curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet

注:在CentOS中要安装.net core环境须要libunwind和libicu库,因此要先安装好这两个运行库,不然会报错:git

dotnet_install: Error: Unable to locate libunwind. Install libunwind to continue
dotnet_install: Error: Unable to locate libicu. Install libicu to continuegithub

yum install libunwind
yum install libicu

 

 -> 安装完.net core后咱们须要配置一个快捷方式,也能够配置环境变量,不然CentOS不认识dotnet命令

sudo ln -s ~/dotnet/dotnet /usr/local/bin

到这里CentOS的.NET Core环境安装完毕!web

 

测试运行环境

  -> 新建一个.Net项目bash

  

#建立项目文件夹
mkdir myfirstdotnetcoreapp
cd myfirstdotnetcoreapp

#建立项目
dotnet new

#编译
dotnet restore

#运行
dotnet run

运行成功后打印:app

Project myfirstdotnetapp (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Hello World!curl

相关文章
相关标签/搜索