SubSonic DAL, assembly not found?
-
13-06-2021 - |
سؤال
I have generated a DAL layer with Subsonic2.2 for a .NET4.0 application, using c# and mysql. Yet when I use a Collection, i have this exception on this line:
AnagraficaCategorieCollection a = new AnagraficaCategorieCollection().Load();
telling me that it cannot load or find assembly MySql.Data, version 5.2.3.0.
My project references a newer version. How can I possibly solve that?
المحلول
The solution is to use an assembly redirect, which tells the framework to use a newer version of MySql.Data. To add the redirection, put this in your web/app.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="5.0.0.0-6.5.3.0" newVersion="6.5.4.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Note that you may need to change the version numbers to match your current assembly.
لا تنتمي إلى StackOverflow