MySQL.Data.dll引用错误 [英] MySQL.Data.dll reference error

查看:259
本文介绍了MySQL.Data.dll引用错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在引用MySql dll的类库项目时遇到问题。我正在使用这个类库在我的项目中进行CRUD操作,以避免一遍又一遍地重写相同的代码。在类库项目中,我有实用程序类,我可以记录错误,连接Oracle,mySQL和MSSQL数据库并做一些事情。



我已经构建了这个类库,让我们说X.dll(项目构建没有错误)并在另一个项目(假设项目A)中添加此X.dll引用为了做一些CRUD操作。看起来像Oracle,MSSQL和日志记录的代码工作,我甚至可以从我的项目A步入引用的DLL代码并从那里调试代码。但是当我尝试使用我在类库项目中编写的mySQL类进行某些处理时,我不允许我进入代码,完全忽略并抛出异常。例外细节是:

Hello all,

I am having a problem with a class library project where a MySql dll is referenced. I am using this class library to make CRUD operations in my projects to avoid rewriting the same code over and over again. In class library projects I have utility class where I can log errors, conenct to Oracle, mySQL and MSSQL databases and do some stuff.

I have built this class library let's say X.dll(the project builds without errors) and add this X.dll reference in another project (Assume Project A) in order to do some CRUD operations. It seems like the code for Oracle, MSSQL and logging works and I can even step into referenced dll code from my Project A and debug the code from there. But when I try to some processing by using the mySQL class that I have written in class library project doesn't allow me to step into the code, totally ignores and throws an exception. The exception details are;

Could not load file or assembly 'MySql.Data, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)





我检查了MySql.Data dll属性,其版本是6.7.4.0并引用它正确地在项目中,我还将MySql.Data.dll文件放在我的bin文件夹中。我也尝试使用NuGet安装MySql dll但仍然有sam错误。



我还在配置文件中添加了以下代码,但仍然没有用。



I have checked the MySql.Data dll properties and its version is 6.7.4.0 and it is referenced correctly in the project and I also placed the MySql.Data.dll file to my bin folder. I also tried installing MySql dll by using NuGet and still I have the sam error.

I have also added the following code to config file but still no good.

<system.data>
    <DbProviderFactories>
        <clear/>
        <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
    </DbProviderFactories>
</system.data>





Btw,我的班级图书馆和我的项目A都在Framework 4.0中。



如果有人有任何ot她的建议我将非常乐意听到它!在此先感谢。



Btw, my class library and my Project A are both in Framework 4.0.

If some have any other recommendations I will be more than happy to hear about it! Thanks in advance.

推荐答案

下载 [ ^ ]并安装MySQL连接器(用于MySQL的ADO.NET驱动程序)净))。如果没用,请告诉我。



其他数据提供者: ADO.NET数据提供商 [ ^ ]
Download[^] and install MySQL connector (ADO.NET Driver for MySQL (Connector/NET)). If it won't help, please let me know.

Other data providers: ADO.NET Data Providers[^]


这篇关于MySQL.Data.dll引用错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆