Page 1 of 1

Excel automation add-in using dotConnect for PostgreSQL

Posted: Sun 19 Feb 2017 18:18
I am attempting to create an Excel automation add-in using VS2013 / C# / dotConnect for PostgreSQL 7.6.699.0 / Entity Framework 6 / Excel 2016. It also uses EF6 to SQL Server.

When I call the add-in from a .Net console application, it works fine. When I call it from Excel the EF6 / SQL Server part works fine, but when I try to access PostgreSQL I get the error:
No Entity Framework provider found for the ADO.NET provider with invariant name 'Devart.Data.PostgreSql'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
I have App.config and an ExcelUDFAsCom.dll.config files, both containing:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity.EF6, Version=7.6.699.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>
I have tried several different things trying to get the PostgreSQL provider to be recognized, including copying the ExcelUDFAsCom.dll.config file into the program files folder that contains Excel.exe. Nothing works.

What can I do to get this to work? Thanks.

Re: Excel automation add-in using dotConnect for PostgreSQL

Posted: Mon 20 Feb 2017 16:06
by Shalex
In case of Excel add-in, please use code-based registration (instead of config file registration): http://blog.devart.com/entity-framework ... #CodeBased.