首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ASP.NET核心Web如何在依赖约束之外解决检测到的包版本

ASP.NET核心Web如何在依赖约束之外解决检测到的包版本
EN

Stack Overflow用户
提问于 2022-04-11 12:35:56
回答 1查看 820关注 0票数 2

在我的ASP.NET Core-6 Web中,当我试图安装时:

AutoMapper.Extensions.Microsoft.DependencyInjection -Version 11.0.0软件包

通过Nugget包,我得到了以下错误:

检测到依赖约束之外的包版本: Duende.IdentityServer.EntityFramework.Storage 5.2.0需要AutoMapper (>= 10.0.0 && of;11.0.0),但版本AutoMapper 11.0.1已被解析。

在尝试解决这个问题时,我安装了AutoMapper ver-11.0.1

然后,应用程序标记已安装的AutoMapper。

我该怎么解决这个问题?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-05-27 21:41:06

TLDR:将AutoMapper.Extensions.Microsoft.DependencyInjection降级为依赖于AutoMapper (>= 10.1.1 && < 11.0.0)8.1.1

https://www.nuget.org/packages/AutoMapper.Extensions.Microsoft.DependencyInjection/8.1.1

较长的答覆:

我也收到了类似的警告或错误,但对我来说,这是在安装NuGet AutoMapper时。

NU1608检测到在依赖约束之外的包版本: Duende.IdentityServer.EntityFramework.Storage 5.2.0需要AutoMapper (>= 10.0.0 && but;11.0.0),但AutoMapper 11.0.1版本已被解析。

您可能已经安装了NuGet Microsoft.AspNetCore.ApiAuthorization.IdentityServer或类似的程序。

https://www.nuget.org/packages/Microsoft.AspNetCore.ApiAuthorization.IdentityServer

如果您查看Microsoft.AspNetCore.ApiAuthorization.IdentityServer NuGet依赖项,您将看到:

  • net6.0
  • Duende.IdentityServer (>= 5.2.0)
  • Duende.IdentityServer.EntityFramework (>= 5.2.0)
  • Duende.IdentityServer.EntityFramework.Storage )>= 5.2.0)
  • Duende.IdentityServer.Storage (>= 5.2.0)
  • Microsoft.AspNetCore.Authentication.JwtBearer (>= 6.0.5)
  • Microsoft.AspNetCore.Identity. ))6.0.5)
  • Microsoft.AspNetCore.Identity.UI (>= 6.0.5)
  • Microsoft.Extensions.Http (>= 6.0.0)
  • Newtonsoft.Json (>= 13.0.1)

)

您可以通过手动更新下面的库来解决这个问题:

  • Duende.IdentityServer
  • Duende.IdentityServer.AspNetIdentity
  • Duende.IdentityServer.EntityFramework
  • Duende.IdentityServer.EntityFramework.Storage
  • Duende.IdentityServer.Storage

Duende.IdentityServer.EntityFramework.Storage 6.1.0具有以下依赖项,将修复您的错误:

  • net6.0
  • AutoMapper (>= 11.0.0 &&;12.0.0)
  • Duende.IdentityServer.Storage (>= 6.1.0)
  • Microsoft.EntityFrameworkCore.Relational (>= 6.0.0)

)

https://www.nuget.org/packages/Duende.IdentityServer.EntityFramework.Storage/

但是,在为endpoints.MapRazorPages();运行代码时,这可能会给您提供此异常。

System.Reflection.ReflectionTypeLoadException:‘无法加载一个或多个所请求的类型。'Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext`1’类型中的方法'get_ServerSideSessions‘来自程序集'Microsoft.AspNetCore.ApiAuthorization.IdentityServer,Version=6.0.5.0、Culture=neutral、PublicKeyToken=adb9793829ddae60’没有实现。‘

我已经要求微软更新Microsoft.AspNetCore.ApiAuthorization.IdentityServer,这样它就可以与最新的Duende.IdentityServer.EntityFramework.Storage兼容,从而解决这个问题。

https://github.com/dotnet/aspnetcore/issues/41897

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71827951

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档