Can anyone spot why I keep getting this error testing the EF 5 beta

后端 未结 4 1762
死守一世寂寞
死守一世寂寞 2020-12-01 20:52

Installed visual studio 11 beta as wanted to test EF 5 beta but keep hitting this an error.

Method not found: \'Void System.Data.Objects.ObjectContext

相关标签:
4条回答
  • 2020-12-01 21:16

    Looks like you are using the EF5 EntityFramework.dll but then running with .NET 4 installed instead of .NET 4.5.

    If you are intending to target .NET 4.5, then make sure that .NET 4.5 is installed on the machine on which you are running the code. VS11 installs .NET 4.5 for you, but you can also install just the runtime on a non-dev machine.

    If you are intending to target .NET 4, then make sure that you project is set to target .NET 4 and then uninstall and reinstall the EF5 NuGet package. You must uninstall and reinstall because NuGet won't change the assembly in use automatically when the project is re-taregted.

    Update:

    You may also see this exception if you still have the EF June CTP installed or if it failed to uninstall correctly. Please try to uninstall the June CTP fully before installing VS11. If you still see problems them open a "Developer Command Prompt" as Administrator and run:

    gacutil /u System.Data.Entity,Version=4.2.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089
    

    If this still fails, then you can attempt to force the uninstall from the GAC with:

    gacutil /uf System.Data.Entity,Version=4.2.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089
    
    0 讨论(0)
  • 2020-12-01 21:19

    I solved this problem removing the policy:

    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\policy.4.0.system.data.entity\v4.0_0.0.0.0__b77a5c561934e089\policy.4.0.system.data.entity.config

    Which had this information: ... bindingRedirect oldVersion="4.0.0.0" newVersion="4.2.0.0" ...

    Hope it helps Rui

    0 讨论(0)
  • 2020-12-01 21:31

    Make sure you have .net 4.5 installed on your target system. I had the same message, turned out I didn't have .net 4.5 installed on one of my farm servers.

    0 讨论(0)
  • 2020-12-01 21:34

    If you have trouble getting rid of the 4.2 System.Data.Entity from the GAC like I did, where it complained the installer depended on it,

    G:\Program Files (x86)\Microsoft Visual Studio 2012 Ultimate\VC>gacutil /uf System.Data.Entity,Version=4.2.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.17929
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
    
    Assembly: System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b
    77a5c561934e089, processorArchitecture=MSIL
    Assembly could not be uninstalled because it is required by Windows Installer
    Number of assemblies uninstalled = 0
    Number of failures = 0
    

    you can get rid of the keys in the registry from this folder:

    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\Global
    

    and rerun the gacutil /uf command

    0 讨论(0)
提交回复
热议问题