xunit和System.Interactive.Async

Tom*_*lny 6 .net entity-framework xunit.net .net-core

我试图在我的.NET Core 1.0解决方案中运行单元测试.当我运行一个空的测试它工作正常.但是,只要我尝试创建ApplicationDbContext的新实例,测试就会失败并出现以下异常:

  System.IO.FileLoadException : Could not load file or assembly 'System.Interactive.Async, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Stack Trace:
       at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.AddQuery(IServiceCollection serviceCollection)
       at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.AddEntityFramework(IServiceCollection serviceCollection)
       at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<>c__DisplayClass4_0.<GetOrAdd>b__1(Int64 k)
       at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
       at Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
(2 more stack trace lines from my code)
Run Code Online (Sandbox Code Playgroud)

不知道为什么需要System.Interactive.Async,但我将它作为依赖项添加到我的Tests项目中.但是,在构建时,dll似乎不会复制到bin\Debug \netcoreapp1.0文件夹中.如果我手动复制它的效果完全相同.任何想法我还能做些什么才能让它发挥作用?

Jam*_*mes 7

对我来说这个错误被抛出,因为在我的project.json中我正确地添加了:

"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-*",
Run Code Online (Sandbox Code Playgroud)

使用核心,但我没有删除这行,这是我的文件在其他依赖项之间的进一步:

"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
Run Code Online (Sandbox Code Playgroud)

删除该行后,我就遇到了这个错误.


Foy*_*rim 5

我正在使用SQLite和Entity Framework Core.我正面临着以下异常.

Could not load file or assembly 'System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263' or one of its dependencies
Run Code Online (Sandbox Code Playgroud)

我已经安装了所有必需的软件包,但它没有解决.

有一个名为System.Interactive.Async(Ix Async)的包可以通过Nuget安装

然后我的运行时异常就解决了.