efcore: [2.0 provider] Unable to run EF Core specifications tests in .NET 4.6.1 class library
Trying to run functional tests with preview2 from a .NET 4.6.1 class library (SQLCE functional tests)
Exception message:
System.IO.FileLoadException : Could not load file or assembly 'System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Stack Trace:
at Microsoft.EntityFrameworkCore.Metadata.Internal.TableMapping.GetTableMappings(IModel model)
This is blocking me from updating the SQLCE EF Core provider to EF Core 2.0
Steps to reproduce
Run the functional tests: …..\packages\xunit.runner.console.2.2.0\tools\xunit.console.exe bin\Debug\EntityFramework.SqlServerCompact.Legacy.FunctionalTests.dll
Further technical details
EF Core version: 2.0 preview2 (from Nuget.org feed) Database Provider: SQL CE Operating system: Win 10 1703 IDE: VS 2017 15.3 preview 3
Branch: https://github.com/ErikEJ/EntityFramework.SqlServerCompact/tree/prev2-prep
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 52 (33 by maintainers)
I was able to get it working with a binding redirect.
Just to update, it does work when I manually add this to app.config (have to create the file for projects that don’t need one)
<dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" /> <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly>But it’s really kind of messed up… For every project that uses the EntityFramework Core 2.0 stuff I have to add this secret sauce… Microsoft isn’t fixing this?
Yes!
Just wanted to leave a comment here in case someone developing an Azure Function App is having problems with setting up a binding redirect for System.ValueTuple. Read this blog post for a solution: https://codopia.wordpress.com/2017/07/21/how-to-fix-the-assembly-binding-redirect-problem-in-azure-functions/
Thanks for that, I fully understand that we are all in a state of transition to .NET Standard, and things are in flux
Yes, tested the binding redirect, works.