【问题标题】:Problem with the Microsoft .AspNetCore 3.1 package in a .Net Standard 2.1 project.Net Standard 2.1 项目中的 Microsoft .AspNetCore 3.1 包存在问题
【发布时间】:2020-02-19 10:29:08
【问题描述】:

我有一个问题,我有一个 Visual Studio 解决方案,其中包含具有微服务架构的不同项目,并且有一个项目具有所有微服务的通用功能,在该项目中我有启动方法,以免在不同的项目中重复代码微服务。问题是在微服务的 Api 项目中,我在启动时使用了 app.UseEndpoints 方法,当我尝试将此代码传输到 .NET Standard 2.1 中的公共项目时,它不允许我安装更新版本nuget 包:Microsoft.AspNetCore.Routing 版本 2.2.2 日期:12/09/2019 而不是 Api 项目提取 .NET Core 3.1.1 的版本

项目 API-REST 微服务:

assembled Microsoft.AspNetCore.Routing, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60

当我将该 nuget 包安装到 net Standard 2.1 项目中时,程序集如下:

assembled Microsoft.AspNetCore, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60

我可以将 Microsoft.AspNetCore 3.1.0 包中的一些功能引入 net Standard 2.1 项目吗?

【问题讨论】:

    标签: c# asp.net-core asp.net-web-api .net-core asp.net-core-mvc


    【解决方案1】:

    不。 AspNetCore 包含比 NetStandard 更多的功能,因此您的链接方向不正确。

    正确的方法是拥有一个 n aspnetcore 3.1 通用包,其中包含(仅)那些 netstandard 无法处理的元素。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-04
      相关资源
      最近更新 更多