You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ADO.NET provider with invariant name 'Npgsql' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.
#1439
Closed
bogdandynamic opened this issue
Feb 13, 2017
· 3 comments
Just installed the .vsix extension (from release 3.2.0) into VS 2015 Community Edition, created a WinForms project targeting .NET Framework 4.6.1, added from Nuget the EntityFramework 6.1.3, Npgsql 3.2.0, EntityFramework6.Npgsql 3.1.1, built the solution. Everything is ok until now. But when I try to run the project, mainly when executing a LINQ command of a context object (getting a count of rows from a table) the exception appears:
The ADO.NET provider with invariant name 'Npgsql' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.
As you said in the documentation, it is no more necessary to include DbProviderFactory entry in app.config or in machine.config or register the assembly to GAC. What am I doing wrong ?
The text was updated successfully, but these errors were encountered:
<system.data>
<DbProviderFactories>
<removeinvariant="Npgsql"/>
<addname="Npgsql Data Provider"invariant="Npgsql"description=".Net Data Provider for PostgreSQL"type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"support="FF"/>
</DbProviderFactories>
</system.data>
If you use the ADO.NET DbProviderFactory API, the Npgsql provider must be registered in your application's App.config (or in your machine-wide machines.config in some specific scenarios). This is something you must do at the level of your project - the VSIX only takes care of PostgreSQL support within Visual Studio itself. To better understand this distinction, imagine someone else cloning your project from git; they're not necessarily going to have the Npgsql VSIX installed, but your App.config is checked into your source control so will automatically be there.
I'll add a note in the documentation making this clear.
Just installed the .vsix extension (from release 3.2.0) into VS 2015 Community Edition, created a WinForms project targeting .NET Framework 4.6.1, added from Nuget the EntityFramework 6.1.3, Npgsql 3.2.0, EntityFramework6.Npgsql 3.1.1, built the solution. Everything is ok until now. But when I try to run the project, mainly when executing a LINQ command of a context object (getting a count of rows from a table) the exception appears:
The ADO.NET provider with invariant name 'Npgsql' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.
As you said in the documentation, it is no more necessary to include DbProviderFactory entry in app.config or in machine.config or register the assembly to GAC. What am I doing wrong ?
The text was updated successfully, but these errors were encountered: