-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.0 provider] Unable to run EF Core specifications tests in .NET 4.6.1 class library #9046
Comments
You may want to switch from using |
How do I do that with an existing project? |
Found Nate's guide: http://www.natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/ |
That's more than necessary. You can use "old" csproj just with For example, instead of this... <ItemGroup>
<Reference Include="Microsoft.EntityFrameworkCore.Relational.Specification.Tests, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.EntityFrameworkCore.Relational.Specification.Tests.2.0.0-preview2-25099\lib\net46\Microsoft.EntityFrameworkCore.Relational.Specification.Tests.dll</HintPath>
</Reference>
<!-- (and it's dozens of dependencies) -->
</ItemGroup> ...you can delete the <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Specification.Tests">
<Version>2.0.0-preview2-25099</Version>
</PackageReference>
</ItemGroup> |
Great, let me try that! |
Getting this after changing to PackageReference only: 1>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore. Should I install the 2.0 SDK? |
Hmm... You shouldn't need it, but does adding the following help? <PropertyGroup>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
</PropertyGroup> |
Nope! |
Did you close and re-open the solution? NuGet (in VS) may be in a bad state. |
Yes, no dice... |
Well, scratch that idea then. Keep the Try deleting the Also ensure you're targeting .NET Framework 4.6.1 everywhere. |
Tried that - no luck at all, back to square one. Add-BindingRedirect did not add any app.config at all. |
I was able to get it working with a binding redirect.
|
Thanks very much, Brad! I will try it out - but not really a sustainable, long term solution, given that NuGet does not even add this binding redirect. |
Yes, tested the binding redirect, works. |
@ErikEJ Are you unblocked now? If there are issues doing things that should work but don't seem to, then it would be great if you could file issues against NuGet. |
@ajcvickers Yes, I am able to run the tests with the binding redirect added manually, and the xunit console runner. As metioned here: #9053 (comment) I do not have any hopes of ever being able to ship a 2.0-preview2-final provider, sadly. Hope the issue gets fixed, and that there will be proper support for .NET 4.6.1 based providers by RTM.... |
@ErikEJ Very sorry to hear that Erik, but it's not completely clear to me what it is that is blocking you. Is it that the development experience for external contributors is just too hard/inefficient, or there still something specific blocking you from releasing? |
Yeah, full framework support got a bit more tricky with preview2. I was able to get going with
|
@ajcvickers |
@ErikEJ So your're saying you can't release it because then your customers would need to manually add the binding direct, and that's not acceptable? |
Yes! |
Okay, thanks. Your feedback is greatly appreciated and will be communicated up. |
Thanks for that, I fully understand that we are all in a state of transition to .NET Standard, and things are in flux |
@BradBarnich I is my understanding that 3 and 4 on your list are fixed by using VS 2017 15.3 preview 3, and yes, .NET 4.6.1 is now the minimum requirement for EF Core |
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/ |
With regards to the article https://codopia.wordpress.com/2017/07/21/how-to-fix-the-assembly-binding-redirect-problem-in-azure-functions/
and it is saying it can't find the assembly. |
Ignore my last message....this worked for me
|
Hi, I have been trying to follow each of the discussions about the System.ValueTuple issue but im stuggling to understand. I get the same error @ErikEJ mentions at the start of this when i try to run a unit test that uses UseInMemoryDatabase for EF Core. Each of my projects target Framework 4.7. I have tried adding the following to my unit test project, but it doesnt appear to have any effect: I have also tried putting the following in app.config of my test project:
Have I put these in the wrong place or have i missed something else? |
@philip-reed That looks like the wrong version number! Make sure to use VS 2017 15.3 or later |
@ErikEJ I had tried various version numbers for System.ValueTuple when trying this, and 4.6 was just the latest attempt. If i look in the bin folder of my web project (the one under test) i have the following for System.ValueTuple, and this is where i got the version number from: |
Product version != Assembly version
|
@ErikEJ I swear i tried that, but it is working now, thank you. I started at version 4.6.1, and tried 4.7 to see if it resolved this issue, seems happy now either way. Thanks again. |
For anyone having issues with this, here is a great workaround for Azure Functions |
We have this issue new, with .Net 2.0 Core. Using VS 2017 15.3.3. Have not done the binding redirect.. kind of perplexed that this issue is still here to begin with. |
Interesting... I searched for the cc7b13ffcd2ddd51 key, and it's finding it in app.config files as a different lib: |
@codearoo - Can you run |
@smitpatel Product Information: Runtime Environment: Microsoft .NET Core Shared Framework Host Version : 2.0.0 |
it's EntityFramework core project that seems to be throwing this. |
I ran into the same issue. In vs2017 15.3.2, I have a classic csproj using .NET 4.6.2 with my unit tests for EF Core 2.0. When I create a DbContext derived type instance, I get:
When I use the binding redirect I don't get the exception anymore but the test which caused this also doesn't run anymore, so the bindingredirect isn't really usable. Will try with a csproj in the new format to see whether that works... |
@FransBouma It works fine for me in a classic unit test csproj with the binding redirect: |
@ErikEJ hmm. You use nunit? As I couldn't get it to work whatever I tried. A new csproj format with these: dotnet/sdk#1070 worked. |
@FransBouma as you can see from the tests i use xunit and execute with testdriven.net |
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) 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? |
Hi! I'm sorry resurrecting this old closed issue but I'm having one of the mentioned error in my project:
and really have no idea where to look after reading everything google found. All details are in the SO question. But briefly what was the reason of "Your project.json doesn't have a runtimes section" error? All subsequent suggestions on bindingRedirects puzzle me as I thought binding redirects happens at runtime but the error happens at build time. |
I'm still having still problem, above solutions did not work, any suggestions? EF Core version: 2.1.0-preview2-final |
@jessetabak - Please file a new issue, with the description & repro steps of the issue you are seeing. |
@smitpatel I resolved the issue, apparently I also needed to install the Microsoft.EntityFrameworkCore.Sqlite nuget package in the startup project |
Trying to run functional tests with preview2 from a .NET 4.6.1 class library (SQLCE functional tests)
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
The text was updated successfully, but these errors were encountered: