c# - .NET Core 3.0 迁移错误 IAsyncEnumerable<T> 存在于 System.Interactive.Async 和 System.Runtime 中

标签 c# .net-core .net-core-3.0

我正在尝试将一个项目从 .net core 2.2 迁移到 3.0。

我收到错误:

Error CS0433 The type 'IAsyncEnumerable< T >' exists in both 'System.Interactive.Async, Version=3.2.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263' and 'System.Runtime, Version=4.2.1.0

我在这里尝试了一个建议: https://github.com/aspnet/EntityFrameworkCore/issues/15047这建议强制更新到 System.Interactive.Async 4.0.0。 (我将此引用添加到我的项目中)。

但是我有另一个错误: 对类型“IAsyncEnumerable<>”的引用声称它是在“System.Interactive.Async”中定义的,但找不到它

我正在使用 IAsyncQueryProvider,似乎是它导致了问题。

我在 2.2 中没有这些问题,目前我找不到任何解决方法。

我还尝试强制更新到 System.Runtime 4.3.1,但没有帮助。

最佳答案

作为在 .NET Core 2.2 上偶然发现这个但没有迁移到 3+ 的人,我在 same issue referenced above 上找到了另一个解决方案。 . 引用的项目文件自此评论以来已修改,因此 here's a direct link .

在我的例子中,我将这个目标添加到项目文件中:

<Target Name="AddAssemblyAliasToReactiveAsync"
        AfterTargets="ResolveAssemblyReferences"
        Condition="'$(TargetFramework)' == 'netcoreapp2.2'">
  <ItemGroup>
    <ReferencePath Condition=" '%(FileName)' == 'System.Interactive.Async' ">
      <Aliases>reactive</Aliases>
    </ReferencePath>
  </ItemGroup>
</Target>

关于c# - .NET Core 3.0 迁移错误 IAsyncEnumerable<T> 存在于 System.Interactive.Async 和 System.Runtime 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58603498/

相关文章:

c# - .Net Core 3.1 HttpClient 不重用套接字

c# - ef core3 中 HasForeignKey 和 ForSqlServerUseSequenceHiLo 方法的替代方法是什么?

c# - 在 windows Phone 8 sdk 中显示 "Loading"

c# - Asp.net web 表单、Asp Identity - 如何存储来自 Facebook、Twitter 等的声明

c# - EntityFramework StartsWith() 生成的 SQL 包含计划更改 ESCAPE '~'(代字号)

c# - ASP.NET Core websocket 管理器 - websockets 总是被释放

asp.net-core - .NET Core 是否支持 SqlDependency?

c# - Nethereum - 方法 eth_feeHistory 不存在或不可用

c# - 使用 Json.NET 序列化后的程序集卸载

c# - 为什么ubuntu中的NET Core 3.1 BackgroundWorker无法访问环境变量?