“项目“ Web”必须提供配置值”迁移到.NET Core 3后出现错误 [英] "The project 'Web' must provide a value for Configuration" error after migrating to .NET Core 3

查看:249
本文介绍了“项目“ Web”必须提供配置值”迁移到.NET Core 3后出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将ASP.NET Core 2.2项目迁移到Core 3.0并收到错误:

I've migrated an ASP.NET Core 2.2 project to Core 3.0 and am getting the error:


项目[项目位置]必须提供一个配置值。

The project [Project location] must provide a value for Configuration.

该错误消息并没有太多内容,有人知道如何解决此错误吗?

There's not really a lot to go on with that error message, does anyone know how to resolve this error?

这看起来可能类似于 dotnet上的此问题cli github repo

推荐答案

问题原来是我仍在引用 .proj文件的程序包引用中的Microsoft.AspNetCore.Razor.Design版本= 2.2.0 。删除该引用(由于 Razor.Design 现在根本不需要,它已成为AspNetCore库的一部分)。

The issue turned out to be that I was still referencing Microsoft.AspNetCore.Razor.Design Version="2.2.0" in the .proj file's package references. Deleting that reference (which isn't needed at all as Razor.Design is now part of AspNetCore library) fixed the issue.

一旦这样做,我就会收到关于可空对象是与剃须刀不兼容的新功能的数百个错误。那是因为我的.proj文件中有< LangVersion>最新< / LangVersion> 。删除该行可以解决该问题,并使项目重新运行。

Once I'd done that, I then got hundreds of errors about nullable objects being a new feature not compatible with razor. That was because I had <LangVersion>Latest</LangVersion> in my .proj file. Removing that line fixed that issue and got the project running again.

(根据某些评论,在某些情况下,您可能还需要清理,重建和/或重新启动VS。 github线程)

(In some cases you might need to clean and rebuild and/or restart VS too, according to comments on the github thread)

如果仍不能解决问题,则可能是您的项目使用的NuGet软件包之一。尝试删除依赖项以查看是否可以解决问题,然后一次重新添加一个以找出是哪个NuGet软件包引起的。

If that doesn't solve it, it's possible that one the NuGet packages used by your project is the cause. Try removing the dependencies to see if that clears the issue, and then re-add them one at a time to work out which NuGet package is the cause.

这篇关于“项目“ Web”必须提供配置值”迁移到.NET Core 3后出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆