我正在尝试在我的.NET Core1.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)不确定为什么需要System.Interactive.Async,但我将它作为依赖项添加到我的测试项目中。但是,在构建时,dll似乎没有复制到bin\Debug\netcoreapp1.0文件夹中。如果我手动将其复制到那里,效果完全相同。你知道我还能做些什么来让它工作吗?
发布于 2016-07-07 17:15:59
对我来说,抛出这个错误是因为在我的project.json中我正确地添加了:
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-*",来使用core,但我没有删除这一行,这行位于我的文件中其他依赖项之间的更深一层:
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",一旦我删除了这一行,我就克服了这个错误。
发布于 2016-12-12 11:47:31
我使用的是SQLite和实体框架核心。我正面临着下面的异常。
Could not load file or assembly 'System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263' or one of its dependencies我已经安装了所有必需的包,但没有解决问题。
有一个名为System.Interactive.Async (Ix Async)的软件包可通过Nuget安装
然后我的运行时异常就解决了。
发布于 2016-07-23 08:52:43
对我来说,这是一条错误的路线
EntityFramework.InMemory
除了之外,还在project.json中添加了Microsoft.EntityFrameworkCore.InMemory。一旦我删除了,它就开始工作了
https://stackoverflow.com/questions/38206239
复制相似问题