0

Visual Studio 2012 question:

Recently installed 2012 (2010 was on here already) ... downloaded project from TFS ... went to run the project and it needed EntityFramework ... Installed EntityFramework from NuGet ...

Here's the problem: now it is throwing an error:

Could not load file or assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=...' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

With this error, we searched and found that a way to get this resolved would be to clear the instance from the GAC. I went to clear the GAC from the Visual Studio Command Prompt (which, BTW, it only came up with the 2010 command prompt) using the command:

gacutil /u "EntityFramework ..."

Which returned:

  • No assemblies found matching: EntityFramework
  • Number of assemblies uninstalled = 0
  • Number of failures = 0

So I was wondering if anyone may have encountered this issue and found a solution -or- if someone may have a solution to the overall problem. Thanks!

Theo Tigno
  • 1
  • 1
  • 1

2 Answers2

1

It looks like something has hard-coded a reference to EntityFramework version 4.1.

EntityFramework (according to nuget) is currently on version 5 (although I believe that the assembly version number is 4.4.0.0).

To get round this you can either install a specific version of the package (see here) or use assembly binding redirection to force it to use a later version (an example of which is shown here).

Matthew Steeples
  • 7,858
  • 4
  • 34
  • 49
1

I followed this:

http://msdn.microsoft.com/en-us/library/aa559881.aspx

But the dll I was trying to uninstall was "stuck".

Which led me to this:

http://support.microsoft.com/kb/873195

I removed the registry entry.

The gacutil /u now worked.

And the error went away.

After I did the registry tweak, my full uninstall looked like this:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /u "EntityFramework,Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
granadaCoder
  • 26,328
  • 10
  • 113
  • 146