我正在尝试将一个项目从 .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/