.NET跨平台之旅:升级ASP.NET Core示例站点
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"
]
}
}
解决这个问题之后,升级成功!
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 2分钟学会 DeepSeek API,竟然比官方更好用!
· .NET 使用 DeepSeek R1 开发智能 AI 客户端
· DeepSeek本地性能调优
· autohue.js:让你的图片和背景融为一体,绝了!
· 10亿数据,如何做迁移?
2013-04-26 云计算之路-阿里云上:希望从今天开始乌云变蓝天
2010-04-26 上周热点回顾(4.19-4.25)