1、参考 https://blog.csdn.net/diehe5608/article/details/102323790
https://blog.csdn.net/decn33932/article/details/102208034
https://blog.csdn.net/weixin_42909660/article/details/88949162
2、C:\Windows\Microsoft.Net\Framework64\v4.0.30319\Config\machine.config
在其中的DbProviderFactories节点下添加
<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=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
3、使用Nuget安装包,此处看到选择的版本是6.7.9, 注意和machine.config中的Version对应
4、进入sn所在路径
查看PublicKeyToken可以使用
D:\Microsoft Visual Studio\2019\Community>sn -Tp F:\mysql.data.dll
Microsoft(R) .NET Framework 强名称实用工具 版本 4.0.30319.0
版权所有(C) Microsoft Corporation。保留所有权利。
公钥(哈希算法: sha1):
0024000004800000940000000602000000240000525341310004000001000100d973bda91f7175
2c78294126974a41a08643168271f65fc0fb3cd45f658da01fbca75ac74067d18e7afbf1467d7a
519ce0248b13719717281bb4ddd4ecd71a580dfe0912dfc3690b1d24c7e1975bf7eed90e4ab14e
10501eedf763bff8ac204f955c9c15c2cf4ebf6563d8320b6ea8d1ea3807623141f4b81ae30a6c
886b3ee1
公钥标记为 c5687fc88969c44d