Firebird & Visual Studio 2010 Failed to find Data Provider

只谈情不闲聊 提交于 2019-12-24 11:59:54

问题


I have Windows 7 64bit. I am trying to use Firebird with VS 2010.

I get the following error:

Failed to find or load the registered .Net Framework Data Provider.

I have done the following

  1. Installed "NETProvider-2.6.5.msi"
  2. Extracted "FirebirdDDEXProvider-2.0.5.zip"

I copied the .dll's from the DDEX zip file to the directory C:\Program Files (x86)\FirebirdClient The contents of which are:

FirebirdSql.Data.FirebirdClient.dll
FirebirdSql.Data.UnitTests.dll
FirebirdSql.VisualStudio.DataTools.dll
FirebirdSql.VisualStudio.DataToolsUI.dll

I edited the 2 reg files from the DDEX, replacing "%path%" with "C:\Program Files (x86)\FirebirdClient"

From the directory "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools" I have run the Gacutil, as follows

cd "C:\Program Files (x86)\FirebirdClient"
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /i FirebirdSql.VisualStudio.DataTools.dll

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /i FirebirdSql.Data.FirebirdClient.dll

I could not use the other Gacutil, as it said it was built for a previous version.

I have also run

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /l Firebirdsql.data.firebirdclient

Which gave me:

The Global Assembly Cache contains the following assemblies:
Firebirdsql.data.firebirdclient, Version=2.6.5.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL

From the directory C:\Windows\Microsoft.NET I have modified the following 4 files:

\Framework\v4.0.30319\Config\machine.config
\Framework\v2.0.50727\Config\machine.config

\Framework64\v2.0.50727\Config\machine.config
\Framework64\v4.0.30319\Config\machine.config

In each of these files, I have added the following 2 entries

<configuration>
    <configSections>
        <section name="FirebirdSql.Data.FirebirdClient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.6.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </configSections>
</configuration>

<system.data>
    <DbProviderFactories>
       <add name="Firebird Client Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.6.5.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
    </DbProviderFactories>
</system.data>

After all of this, I still can't get firebird working withing Visual studio. I can view the database & tables from within the Server explorer, however I can't add a datasource, at the finish step, it gives an error:

"An error occurred while creating the new data source: Could not get type information for "WinFormsApp.DataSet1".

As a better example, Using the DbProviderFactory, Firebird is the 5th index, I run the following code:

try
   {
      DataTable dt = DbProviderFactories.GetFactoryClasses();
      // Use this for loop to see what row holds FirebirdClient
      for (int i = 0; i < dt.Rows.Count; i++)
          Console.WriteLine("{0}: {1}", i.ToString(), dt.Rows[i][2].ToString());

      // For me, FirebirdClient is at row 5
      DbProviderFactory dataFactory = DbProviderFactories.GetFactory(dt.Rows[5]);

The following exception appears:

Failed to find or load the registered .Net Framework Data Provider.

Exception:

System.Configuration.ConfigurationErrorsException was caught
  Message=Failed to find or load the registered .Net Framework Data Provider.
  Source=System.Data
  BareMessage=Failed to find or load the registered .Net Framework Data Provider.
  Line=0
  StackTrace:
       at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
       at Forms.TestForm.TestConn() in C:\Data\Projects\Dev\FirebirdTest\Forms\TestForm.cs:line 113
  InnerException: null

Can anyone please assist.


回答1:


This line in the machine.config:

<configSections>
    <section name="FirebirdSql.Data.FirebirdClient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=2.6.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

should read like this:

<configSections>
    <section name="firebirdsql.data.firebirdclient" type="System.Data.Common.DbProviderConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

Note that the version is different, it's supposed to be the runtime versin and not the version of the firebird client. Also I believe that you need only edit the 32bit version of the machine.config since VS is a 32 bit application.




回答2:


When you change the %path%, you need to do it this way:

C:\\Program Files (x86)\\FirebirdClient



来源:https://stackoverflow.com/questions/8178719/firebird-visual-studio-2010-failed-to-find-data-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!