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

时间:2019-10-29 08:17:31

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

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

我遇到了错误:

  

错误CS0433类型'IAsyncEnumerable '同时存在   'System.Interactive.Async,版本= 3.2.0.0,区域性=中性,   PublicKeyToken = 94bc3704cddfc263'和'System.Runtime,版本= 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,但这没有帮助。

3 个答案:

答案 0 :(得分:4)

作为一个在.NET Core 2.2上偶然发现此问题但没有迁移到3+版本的人,我在same issue refereced before上找到了另一个解决方案。 自此注释以来,引用的项目文件已修改,因此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>

答案 1 :(得分:2)

Panatiotis的建议起作用了,我将引用添加到Microsoft.EntityFrameworkCore 3.0,它起作用了。对于我的情况,.NET Core 2.2中不需要此引用。

答案 2 :(得分:1)

尽管问题已经回答,但我在这里找到了:https://github.com/dotnet/efcore/issues/14239一个与此人有类似问题且与我几乎相同的人。

使用EntityFrameworkCore(3.1.1)和IAsyncEnumerable接口的netcoreapp3.1项目。 我的构建因以下错误而结束:

cycle

问题是由使用nuget restore命令(不是dotnet restore)引起的,并且我具有nuget.exe的旧版本。升级到最新的nuget.exe可以修复该版本。