Ubuntu 14.04 上安装使用 .NET Core

.NET Core 1.0 正式发布了,所以决定在Ubuntu 14.04 上安装使用。

根据介绍页面的步骤:

步骤1.

sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
sudo apt-get update

步骤2.

sudo apt-get install dotnet-dev-1.0.0-preview2-003121

步骤3.

mkdir hwapp

cd hwapp

dotnet new

步骤4.

dotnet restore

dotnet run

结果出了不少问题:

问题1,由于网络原因,资源下载不下来——只能反复尝试

问题2,执行dotnet run 时报错:

The specified framework 'Microsoft.NETCore.App', version '1.0.0-rc2-3002702' was not found.
- Check application dependencies and target a framework version installed at:
/usr/share/dotnet/shared/Microsoft.NETCore.App
- The following versions are installed:
1.0.0
- Alternatively, install the framework version '1.0.0-rc2-3002702'.
SUMMARY: Total: 1 targets, Passed: 0, Failed: 1.

问题2解决方法

在步骤2后面,执行如下命令:

apt-get install dotnet-sharedframework-microsoft.netcore.app-1.0.0-rc2-3002702

解决上面问题后,再执行:dotnet run

结果如下图:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15194.html