npgsql: Could not load EntityFramework5.Npgsql while attempting to Generate Database from Model

I’m trying to generate a completely new Database given schema in the VS EF designer.

Steps to reproduce

I installed the latest VSIX Npgsql VS extension, installed the latest EntityFramework6.Npgsql from Nuget, then updated Npgsql to its latest version which added a bunch of other dependencies to my package.xml file.

I couldn’t get the Server Explorer working to connect to my DB without running the Npgsql-3.2.0.msi installer, doing whatever it does to the GAC.

The GAC vs. VSIX things must be causing some kind of conflict, because I can’t get ‘Generate Database from Model…’ to work. I’m blocked by this exception:

Running transformation: System.Exception: Could not load EntityFramework5.Npgsql assembly, is it installed? ---> System.IO.FileLoadException: Could not load file or assembly 'EntityFramework5.Npgsql, Version=3.2.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Npgsql.NpgsqlFactory.GetService(Type serviceType)
   --- End of inner exception stack trace ---
   at Npgsql.NpgsqlFactory.GetService(Type serviceType)
   at System.Data.Common.DbProviderServices.GetProviderServices(DbProviderFactory factory)
   at System.Data.Metadata.Edm.StoreItemCollection.Loader.InitializeProviderManifest(Action`3 addError)
   at System.Data.Metadata.Edm.StoreItemCollection.Loader.OnProviderManifestTokenNotification(String token, Action`3 addError)
   at System.Data.EntityModel.SchemaObjectModel.Schema.HandleProviderManifestTokenAttribute(XmlReader reader)
   at System.Data.EntityModel.SchemaObjectModel.Schema.HandleAttribute(XmlReader reader)
   at System.Data.EntityModel.SchemaObjectModel.SchemaElement.ParseAttribute(XmlReader reader)
   at System.Data.EntityModel.SchemaObjectModel.SchemaElement.Parse(XmlReader reader)
   at System.Data.EntityModel.SchemaObjectModel.Schema.HandleTopLevelSchemaElement(XmlReader reader)
   at System.Data.EntityModel.SchemaObjectModel.Schema.InternalParse(XmlReader sourceReader, String sourceLocation)
   at System.Data.EntityModel.SchemaObjectModel.Schema.Parse(XmlReader sourceReader, String sourceLocation)
   at System.Data.EntityModel.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, AttributeValueNotification providerNotification, AttributeValueNotification providerManifestTokenNotification, ProviderManifestNeeded providerManifestNeeded, IList`1& schemaCollection)
   at System.Data.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths)
   at System.Data.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerManifestToken, Memoizer`2& cachedCTypeFunction)
   at System.Data.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders)
   at Microsoft.VisualStudio.TextTemplating2F696CF54A78FB975602BEF34A38D7117E3374EEB7D5E1026777AF9F6D192A08E379AC860C457C14BA015A701FC668D13EEDAE3E86ACDB9F8A813B560E3188BB.GeneratedTextTransformation.get_StoreItems()
   at Microsoft.VisualStudio.TextTemplating2F696CF54A78FB975602BEF34A38D7117E3374EEB7D5E1026777AF9F6D192A08E379AC860C457C14BA015A701FC668D13EEDAE3E86ACDB9F8A813B560E3188BB.GeneratedTextTransformation.TransformText()	Pawn	C:\Users\Chance Snow\Documents\GitHub\million-dollar-pawn\client\Pawn\Models\SSDLToPgSQL.tt	1

Further technical details

Npgsql v3.2.0 EntityFramework6.Npgsql v3.1.1 EntityFramework v6.1.3 Npgsql PostgreSQL Integration v3.2.0 PostgreSQL v9.6.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 31 (11 by maintainers)

Most upvoted comments

Hooking into this issue, even though it’s somewhat different: I am able to manage my .edmx file without any issue however, only when the project isn’t built. Doesn’t make much sense to me, but whenever I clean my solution/project, the edmx opens up just fine, and whenever it’s built, I get the “Could not load EntityFramework5.Npgsql assembly, is it installed?” message.

I’m using both latest Npgsql/EntityFramework6.Npgsql version packages & latest VSIX extension for VS2017.