首頁 > 軟體

Ubuntu 14.04 上安裝使用 .NET Core

2020-06-16 17:38:35

.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

結果如下圖:


IT145.com E-mail:sddin#qq.com