错误:
An unhandled exception of type 'System.IO.FileLoadException' occurred in WindowsFormsApplication4.exe
Additional information: Could not load file or assembly 'MySql.Data, Version=8.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
信息:
问题:
我使用MySQL创建了一个类库,可以对我的在线数据库运行各种查询。
在我的单独项目中包含dll后,我使用的唯一代码行如下:(它会引发异常)
// Runs a simple select statement to find matches for 'John Doe' in my online MySQL database table... and stores results to a dataset
DataSet ds = MyDllNameSpace.Database.People.Load("John", "Doe");
App.Config文件:
我的dll项目:(我没有签署此项目)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data></configuration>
我的单独项目:(我没有签署此项目)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.8.0" newVersion="8.0.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
我搜索/尝试的内容:
谢谢
答案 0 :(得分:0)
您是否尝试过签署项目?这可能会删除您的错误。
也许这个关于您的错误的链接会有所帮助:https://blogs.msdn.microsoft.com/keithmg/2012/03/20/strong-name-validation-failed-exception-from-hresult-0x8013141a/
或此stackoverflow问题: Strong Name Validation Failed