tom*_*dox 12 .net-core asp.net-core .net-core-3.0
我已经将ASP.NET Core 2.2项目迁移到Core 3.0,并且收到错误消息:
项目[项目位置]必须为Configuration提供一个值。
该错误消息并没有太多处理,有人知道如何解决该错误吗?
This looks like it could be similar to this issue on the dotnet cli github repo.
tom*_*dox 31
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.
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.
(In some cases you might need to clean and rebuild and/or restart VS too, according to comments on the github thread)
如果仍不能解决问题,则可能是项目使用的NuGet软件包之一。尝试删除依赖项以查看是否可以解决问题,然后一次重新添加一个以找出是哪个NuGet软件包引起的。
小智 23
我遇到了同样的问题,通过删除以下引用解决了这个问题:
"Microsoft.AspNetCore.Mvc" Version="2.2.0"
"Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="2.2.0"
Run Code Online (Sandbox Code Playgroud)
Rob*_*ton 21
MS 文档标题为“ Migrate from ASP.NET Core 2.2 to 3.0 ”。在“更新项目文件”下,它指出,
“大量 NuGet 包不是为 ASP.NET Core 3.0 生成的。应从项目文件中删除此类包引用”
作为例子给出的两个是:
在其下方,您可以展开以查看所有不再生产的包:
- 微软.AspNetCore
- 微软.AspNetCore.All
- 微软.AspNetCore.App
- Microsoft.AspNetCore.Antiforgery
- Microsoft.AspNetCore.Authentication
- Microsoft.AspNetCore.Authentication.Abstractions
- Microsoft.AspNetCore.Authentication.Cookies
- Microsoft.AspNetCore.Authentication.Core
- Microsoft.AspNetCore.Authentication.OAuth
- Microsoft.AspNetCore.Authorization.Policy
- Microsoft.AspNetCore.CookiePolicy
- 微软.AspNetCore.Cors
- Microsoft.AspNetCore.Diagnostics
- Microsoft.AspNetCore.Diagnostics.HealthChecks
- Microsoft.AspNetCore.HostFiltering
- Microsoft.AspNetCore.Hosting
- Microsoft.AspNetCore.Hosting.Abstractions
- Microsoft.AspNetCore.Hosting.Server.Abstractions
- 微软.AspNetCore.Http
- Microsoft.AspNetCore.Http.Abstractions
- Microsoft.AspNetCore.Http.Connections
- Microsoft.AspNetCore.Http.Extensions
- Microsoft.AspNetCore.HttpOverrides
- Microsoft.AspNetCore.HttpsPolicy
- Microsoft.AspNetCore.Identity
- Microsoft.AspNetCore.Localization
- Microsoft.AspNetCore.Localization.Routing
- 微软.AspNetCore.Mvc
- Microsoft.AspNetCore.Mvc.Abstractions
- Microsoft.AspNetCore.Mvc.Analyzers
- Microsoft.AspNetCore.Mvc.ApiExplorer
- Microsoft.AspNetCore.Mvc.Api.Analyzers
- Microsoft.AspNetCore.Mvc.Core
- Microsoft.AspNetCore.Mvc.Cors
- Microsoft.AspNetCore.Mvc.DataAnnotations
- Microsoft.AspNetCore.Mvc.Formatters.Json
- Microsoft.AspNetCore.Mvc.Formatters.Xml
- Microsoft.AspNetCore.Mvc.Localization
- Microsoft.AspNetCore.Mvc.Razor
- Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
- Microsoft.AspNetCore.Mvc.RazorPages
- Microsoft.AspNetCore.Mvc.TagHelpers
- Microsoft.AspNetCore.Mvc.ViewFeatures
- 微软.AspNetCore.Razor
- Microsoft.AspNetCore.Razor.Runtime
- Microsoft.AspNetCore.Razor.Design
- Microsoft.AspNetCore.ResponseCaching
- Microsoft.AspNetCore.ResponseCaching.Abstractions
- Microsoft.AspNetCore.ResponseCompression
- Microsoft.AspNetCore.Rewrite
- Microsoft.AspNetCore.Routing
- Microsoft.AspNetCore.Routing.Abstractions
- Microsoft.AspNetCore.Server.HttpSys
- 微软.AspNetCore.Server.IIS
- Microsoft.AspNetCore.Server.IISIntegration
- Microsoft.AspNetCore.Server.Kestrel
- Microsoft.AspNetCore.Server.Kestrel.Core
- Microsoft.AspNetCore.Server.Kestrel.Https
- Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions
- Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
- Microsoft.AspNetCore.Session
- Microsoft.AspNetCore.SignalR
- Microsoft.AspNetCore.SignalR.Core
- Microsoft.AspNetCore.StaticFiles
- Microsoft.AspNetCore.WebSockets
- Microsoft.AspNetCore.WebUtilities
- Microsoft.Net.Http.Headers
这有点奇怪。
对我来说,问题是因为“Microsoft.AspNetCore.Mvc”包。
我卸载了它并安装了“Microsoft.AspNetCore.Mvc.Core”。
我需要补充一点,我也安装了“Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation”。
| 归档时间: |
|
| 查看次数: |
1711 次 |
| 最近记录: |