1

Closed

EF6 VStools downgrade EF version from 6.0.1 to 6.0.0 when adding DbContext T4 Template to EDMX file

description

In VS2012 with the EF6 tools installed, the EF version is downgraded from my already added EF 6.0.1 to 6.0.0 when adding DbContext T4 Template to EDMX file.

I've updated the EF again to 6.0.1, but this results into the issue that the EF6.0.0 is missing during runtime.

I've solved it by removing all EF NuGet references, deleted the downloaded package, restarted the VS and installed the EF6.0.1 package again.


The expected behavior is that the tools should detect that a newer EF version is already installed for the project and don't downgrade.
Closed Dec 18, 2013 at 7:10 PM by mgirgin
We could not reproduce this issue on our side so closing this bug.

I think the issue might be a messed-up Visual Studio installation, but can't be sure. Please reactivate if you reproduce this issue on a newly paved machine (i.e. recently installed Windows + Visual Studio.)

comments

jemartti wrote Dec 13, 2013 at 1:17 AM

I'm sorry, but I'm struggling to find a way to reproduce this. Can you help me out by explaining a bit more about your situation? How was EF6.0.1 installed the first time, by the designer? Or are you using both EF and EFTools to manage your model?

Which method of adding the DbContext T4 Template are you using? Right-clicking on the designer surface, "Add Code Generation Item," then EF 6.x DbContext Generator?

Have you been able to reproduce this situation?

AndreZiegler wrote Dec 13, 2013 at 5:23 AM

I installed EF 6.0.1 via NuGet and yes I added the Generator via EDMX with "Add Code Generation Item". Now the EF 6.0.1 is downgraded to EF 6.0.0

jemartti wrote Dec 13, 2013 at 6:03 PM

Have you been able to reproduce this issue? I'm somehow missing something with your setup that's making it so I can't reproduce the issue.

I'm attempting to create a minimal set of steps to reproduce this. I started by creating an empty project, adding a new Empty Model using EF6 Tools, installing EF6.0.1 via NuGet, then "Add Code Generation Item" (EF 6.x DbContext Generator). This results in the following Output:
Attempting to install version '6.0.0' of 'EntityFramework' but the project already includes a different version. Skipping...
Attempting to install version '6.0.0' of 'EntityFramework' but the project already includes a different version. Skipping...
Is there anything different you've done? Can you send me the contents of your Output window when this issue is occurring?

AndreZiegler wrote Dec 16, 2013 at 8:22 AM

I can repro this all the time.

I'm trying to update an EF5 application to EF6. So I removed the old TT files, updated EF5 to EF6.0.1 (now EF6.0.2) and when I added the EF6 generator I see this:

Image

When I now check the references I see that the EF version is set to EF6.0.0:

Image


Do you also use the VS2012 Update4? I do an upgrade from a .Net 4.0 EF5 app (EF4.4). Maybe this is important.

jemartti wrote Dec 17, 2013 at 12:48 AM

I have been trying to use VS2012.4 to reproduce this. Upgrading from an EF5 app seems like it could be important, thanks for that information.

I'm beginning to suspect that this may be an issue with an older version of NuGet. Out of curiousity, what version of NuGet do you have installed (you can find this under Tools->Extensions and Updates)? If you upgrade NuGet to the latest release, does the problem still occur?

AndreZiegler wrote Dec 17, 2013 at 5:42 AM

I use the latest NuGet version 2.7.41101.299 which is the latest version.

I've updated the EF tool to the 6.0.2 version and now I see "Adding EF6.0.2 to project" in the statusbar when adding the Template.

So the tools always install the EF version which matches to the EF tools version of the VS Tools.

jemartti wrote Dec 17, 2013 at 6:13 AM

Hm, that's curious. I attempted to reproduce with both EFTools 6 and EFTools 6.0.2 and I could get neither one to downgrade the project to EF6.0.0. EFTools 6 would attempt to install EF6.0.0 but would always output the message "Attempting to install version '6.0.0' of 'EntityFramework' but the project already includes a different version. Skipping..." It looks like you might be hitting some sort of edge case in the version check code; I'll dig deeper into that tomorrow.

It would be great if you could uninstall EFTools 6.0.2 and retry with a clean install of EFTools 6. If you have the time, I can send you an installer msi if you don't have the past release accessible.

AndreZiegler wrote Dec 17, 2013 at 7:08 AM

The Ef6.02 version doesn't downgrade to 6.0.0.

I reverted the temp changes, this time I did not update the EF5 to 6, only added the new T4 template and here it install EF6.0.2. This is fine. This leads me to the conclusion ,that the tools always install the EF version which match to the EF tools version.

I also don't see the details you post all the time. The PackageManager output is empty for me.

jemartti wrote Dec 17, 2013 at 6:59 PM

None of our team seems to be able to reproduce this. Since this appears to have such a low impact, we have a solution that provides at least a temporary fix, and as we have a significant amount of work to do for the upcoming release, we're going to retriage this to decide if further investigation is required.

mgirgin wrote Dec 18, 2013 at 7:10 PM

We could not reproduce this issue on our side so closing this bug.

I think the issue might be a messed-up Visual Studio installation, but can't be sure. Please reactivate if you reproduce this issue on a newly paved machine (i.e. recently installed Windows + Visual Studio.)