none
ADO.NET Entity requires EF6 assembly that does not exist RRS feed

  • Question

  • I've been struggling to resolve a strange issue when creating an ADO.NET Entity Data object in VS2013 using EF6.1.3.  The errors are generated as soon as the entity model (code first to existing database) is created.  The most salient error message is:

    Error 1 Failed to resolve assembly reference. The path 'D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\..\IDE\EntityFramework.dll' must be either local to this computer or part of your trusted zone. If you have downloaded this template, you may need to 'Unblock' it using the properties page for the template file in File Explorer.. ProcDBModel.tt 0 0 

    The problem is, I eliminated the D: drive about two months ago.  So, this path that it's telling me I have to "Unblock" doesn't even exist.  I've been through all my assemblies and there are no apparent conflicts (using something called asmSpy.exe) - though I removed and recompiled one that had covered legacy MySQL Connector.NET and EF-enabled Connector.NET.  The error was occurring when building to both SQL Server and MySQL Data Connections (same database on each server).  

    I've been eliminating the model (.edmx files) and re-creating it to try the effect of changes in legacy MySQL support as well as eliminating MySQL for Visual Studio (6.7.4, I think).  I've dumped 6.1.1, 1.2, and 1.3 versions of EF6 packages from my system - to no avail.  The only thing that's worked so far is to create the Entity data model against EF5 - No errors with EF5.  

    Online searching tells me to "Unblock" the file using the Properties in File Explorer, but since I can't even find the file this is referring to, I can't unblock it.  And I have yet to see an "Unblock" option in any EF file's properties dialog. Plus, I didn't download the model, I created it from the existing DBs.  So that seems to be misleading. 

    Does anyone have any idea what is generating this error?  


    • Edited by jbgps Friday, March 20, 2015 4:37 AM
    Friday, March 20, 2015 4:34 AM

All replies

  • You need to re-install or repair VS, it thinks it is installed on your D: drive

    Please mark as answer, if this was it. Visit my SQL Server Compact blog http://erikej.blogspot.com

    Friday, March 20, 2015 7:07 AM
  • Have you tried the VS 2013 nuget command line (vie context menu on the desired project) to install the EF6 into your project?

    It sounds to me like youre using a locally stored and installed (maybe in GAC) assembly of the EF6... you don't need to do that, nuget will install it in you projects Folder (under a package Folder in the Projects folder) and you just add refrences to other Projects to this exact EF-Assembly.

    Hope it works

    The Command: Get-Project [#insert name|All|wildcard string#] | Install-Package EntityFramework

    Also, if you use some GAC-Installed EF try some stuff with the gacutil.exe:

    https://msdn.microsoft.com/en-us/library/ex0ss12c%28v=vs.110%29.aspx

    • Edited by MDeero Friday, March 20, 2015 7:16 AM
    Friday, March 20, 2015 7:10 AM
  • Thanks.  EF6 was installed with NuGet.  I started removing these packages from various projects that I've been testing with to see if that would help - going back two months to 6.1.1 - but the problem persisted.  I'll try to spend some time with gacutil.exe to see what I can learn.  
    Friday, March 20, 2015 3:04 PM
  • Thanks. I considered this might be some registry setting.  Can you be certain it's VS and not some version of SQL Server?  
    Friday, March 20, 2015 5:41 PM
  • Yes!

    Please mark as answer, if this was it. Visit my SQL Server Compact blog http://erikej.blogspot.com

    Friday, March 20, 2015 7:54 PM
  • Well, I ran repair on VS2013, it ran for a few hours, then I deleted my EF5 model, updated my references to EF 6.1.3, recreated the model, and ... same thing.  Same errors. So, maybe it needs a total reinstall.  That'll have to wait for a bit.  I'll let you know.  Thanks. 
    Saturday, March 21, 2015 4:20 AM
  • Sorry i couldn't help...

    if nuget won't do it, there is something else worng...

    have you tried to set up a test project to see if EF6 works?

    have you tried a test project where you reference all dlls you use to eliminate the possibility of some dll causeing this error?

    Maybe you can just try this

    https://social.msdn.microsoft.com/Forums/windowsapps/en-US/83db9968-fc8a-4456-b8c4-524cc6e93094/how-do-i-unblock-assemblies?forum=wpdevelop

    • Edited by MDeero Monday, March 23, 2015 7:11 AM
    Monday, March 23, 2015 7:09 AM