npgsql/EntityFramework6.Npgsql

Npgsql version mismatch between app.config and dependent NuGet package

DanielPetatCes opened this issue · 1 comments

Hello,

I created a new .NET Framework 4.7.1 project and installed the Nuget package "EntityFramework6.Npgsql" in version 6.4.0.
By dependency, it installed the project "Npgsql" in version 4.1.2 (and some other), which seems correct for me.

But in the generated app.config, the following entry is created:

<DbProviderFactories> <remove invariant="Npgsql" /> <add name="Npgsql Provider" invariant="Npgsql" description=".NET Framework Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Version=4.0.10.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" /> </DbProviderFactories>

referencing to version 4.0.10.
(For any reason, there is a remove-element although it is not created previously)

When I now try to open a database connection, I get the error message

Die Datei oder Assembly "Npgsql, Version=4.0.10.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)
Dateiname: "Npgsql, Version=4.0.10.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"

Workaround:
When I update the app.config manually to use version 4.1.2.0, it works fine.

Is it really necessary, to use an explicit version here?

Best regards
Daniel

roji commented

Thanks for raising this, I've pushed a fix to be released in 6.4.1. The issue is that the provider depends on Npgsql 4.0.10 when using old .NET Framework TFMs (pre-4.6.1), and on 4.1.2 (the newest) when using the newer TFMs, and these dependencies must be managed accordingly.