Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Comments

@bogdandynamic
Copy link

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 ?

@bogdandynamic
Copy link
Author

bogdandynamic commented Feb 13, 2017

When adding

<system.data>
  <DbProviderFactories>
      <remove invariant="Npgsql"/>
      <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" support="FF"/>
  </DbProviderFactories>
</system.data>

to app.config, everything works fine.

@roji
Copy link
Member

roji commented Feb 14, 2017

This is the expected behavior.

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.

@roji roji closed this as completed Feb 14, 2017
@roji roji added the invalid label Feb 14, 2017
zamachuga added a commit to zamachuga/KnowledgeTesting that referenced this issue Jul 20, 2020
…cadeDelete - почему он ругался при select ???

Определена связь между QuestionAswer - MToM.

Вылезло npgsql/npgsql#1439 после установки VSIX.
@yikekas
Copy link

yikekas commented Dec 23, 2020

uninstalling and reinstalling Npgsql.vsix resolved this problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants