“项目“ Web”必须提供配置值”迁移到.NET Core 3后出现错误

编程入门 行业动态 更新时间:2024-10-19 16:23:11
本文介绍了“项目“ 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后出现错误

本文发布于:2023-11-15 23:36:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598966.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:出现错误   项目   NET   Web   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!