How can I upgrade from .Net Core 2.1 RC1 to the stable version of .NET Core 2.1?

ぐ巨炮叔叔 提交于 2021-01-28 01:40:28

问题


Needing SignalR, having started my project before 30th May, when the stable version of ASP .NET Core 2.1 was released, I opted to use ASP .NET Core 2.1 RC1.

However, once the stable version is released, I'd naturally like to leave the preview version behind and upgrade to the stable version. How to do this?

In order to achieve that, I went to https://www.microsoft.com/net/download/visual-studio-sdks and downloaded .NET Core 2.1 x64 installer from there. However, having installed it, I cannot now compile my project. The compilation fails with the following errors:

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 ==========

How do I fix this?

Honestly, my current idea is to uninstall Visual Studio & all .NET Core SDK entries from Programs & Functions in Control Panel, then install it anew, create a new ASP .NET Core project, paste all source files I manually wrote from the old project to the new one... I suppose here must be a better way?


回答1:


I was getting the same error message. I then tried, without success, to update the Microsoft.AspNetCore.App and Microsoft.NetCore.App NuGet packages and it told me I needed to remove the Microsoft.VisualStudio.Web.CodeGeneration.Design reference. This resolved the issue in my case.



来源:https://stackoverflow.com/questions/50689098/how-can-i-upgrade-from-net-core-2-1-rc1-to-the-stable-version-of-net-core-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!