ASP.NET Core示例站點網址:http://about.cnblogs.com/
首先安裝最新版的 .NET Core 運行環境,從 https://github.com/dotnet/cli 的 readme 中 "Ubuntu Installers" 部分獲取 Shared Host、Shared Framework、Sdk 的下載地址,分別依次下載安裝:
wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb dpkg -i dotnet-host-ubuntu-x64.latest.deb wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb dpkg -i dotnet-sharedframework-ubuntu-x64.latest.deb wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sdk-ubuntu-x64.latest.deb dpkg -i dotnet-sdk-ubuntu-x64.latest.deb
安裝后的 dotnet cli 版本是 1.0.0-rc2-002496 。
然后修改示例站點項目 AboutUs 的 project.json 文件:
1)frameworks 中的 "netstandardapp1.3" 改為 "netcoreapp1.0" ,imports 由 "portable-net45+win8" 改為 "portable-net45+wp80+win8+wpa81+dnxcore50"
2)dependecies 中添加:
"Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0-rc2-23931" },
接着將 NuGet.Config 中的 aspnetcidev 改為 aspnetcirelease:
<configuration> <packageSources> <clear /> <add key="AspNetCI" value="https://www.myget.org/F/aspnetcirelease/api/v3/index.json" /> <add key="NuGet.org" value="https://api.nuget.org/v3/index.json" /> </packageSources> </configuration>
dotnet restore 之后,dotnet run 時出現錯誤:The dependency Ix-Async 1.2.5 does not support framework .NETCoreApp,Version=v1.0。在這個問題上困了很長時間,直到今天看到這篇博文 —— .NET Core 1.0 RC2 歷險之旅,才發現了如下的解決方法:
在 "frameworks" -> "netcoreapp1.0" -> "imports" 中添加 "portable-net45+win8+wp8+wpa81" 與 "portable-net45+win8+wp8" 。
"frameworks": {
"netcoreapp1.0": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50",
"portable-net45+win8+wp8+wpa81",
"portable-net45+win8+wp8"
]
}
}
解決這個問題之后,升級成功!