如何从.Net Core 2.1 RC1升级到稳定版的.NET Core 2.1?

时间:2018-06-04 21:34:19

标签: asp.net-core .net-core asp.net-core-2.0

需要SignalR,在5月30日之前启动了我的项目,当ASP .NET Core 2.1的稳定版本发布时,我选择使用ASP .NET Core 2.1 RC1。

然而,一旦稳定版本发布,我自然会想要保留预览版本并升级到稳定版本。怎么做?

为了达到这个目的,我去了https://www.microsoft.com/net/download/visual-studio-sdks并从那里下载了.NET Core 2.1 x64安装程序。但是,安装它后,我现在无法编译我的项目。编译失败,出现以下错误:

NuGet package restore failed. Please see Error List window for detailed warnings and errors.
1>------ Build started: Project: mon, Configuration: Debug Any CPU ------
1>C:\Users\m\source\repos\mon\mon\mon.csproj : warning NU1608: Detected package version outside of dependency constraint: Microsoft.CodeAnalysis.CSharp.Workspaces 2.8.0-beta3 requires Microsoft.CodeAnalysis.CSharp (= 2.8.0-beta3) but version Microsoft.CodeAnalysis.CSharp 2.8.0 was resolved.
1>C:\Users\m\source\repos\mon\mon\mon.csproj : error NU1107: Version conflict detected for Microsoft.CodeAnalysis.Common. Reference the package directly from the project to resolve this issue. 
1>C:\Users\m\source\repos\mon\mon\mon.csproj : error NU1107:  mon -> Microsoft.AspNetCore.App 2.1.0 -> Microsoft.AspNetCore.Mvc.Razor 2.1.0 -> Microsoft.CodeAnalysis.CSharp 2.8.0 -> Microsoft.CodeAnalysis.Common (= 2.8.0) 
1>C:\Users\m\source\repos\mon\mon\mon.csproj : error NU1107:  mon -> Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.0-rc1-final -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.0-rc1-final -> Microsoft.VisualStudio.Web.CodeGeneration 2.1.0-rc1-final -> Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 2.1.0-rc1-final -> Microsoft.VisualStudio.Web.CodeGeneration.Core 2.1.0-rc1-final -> Microsoft.VisualStudio.Web.CodeGeneration.Templating 2.1.0-rc1-final -> Microsoft.VisualStudio.Web.CodeGeneration.Utils 2.1.0-rc1-final -> Microsoft.CodeAnalysis.CSharp.Workspaces 2.8.0-beta3 -> Microsoft.CodeAnalysis.Workspaces.Common 2.8.0-beta3 -> Microsoft.CodeAnalysis.Common (= 2.8.0-beta3).
1>Done building project "mon.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我该如何解决这个问题?

老实说,我目前的想法是卸载Visual Studio&来自Programs& amp;的所有.NET Core SDK条目控制面板中的功能,然后重新安装,创建一个新的ASP .NET Core项目,将我从旧项目手动编写的所有源文件粘贴到新项目中......我想这里必须有更好的方法吗?

1 个答案:

答案 0 :(得分:1)

我收到了同样的错误消息。然后我尝试更新Microsoft.AspNetCore.AppMicrosoft.NetCore.App NuGet包,但没有成功,它告诉我需要删除Microsoft.VisualStudio.Web.CodeGeneration.Design引用。这解决了我的问题。

Remove Microsoft.VisualStudio.Web.CodeGeneration.Design reference under Dependencies under solution explorer