c# – 无法加载“MySql.Data”或其中一个依赖项.

c# – 无法加载“MySql.Data”或其中一个依赖项.,第1张

概述我已经为Visual Studio和.NET Connector(6.7.4.0)安装了MySQL.我之前安装了6.6.5.0.为什么还在寻找这个DLL?System.IO.FileLoadException was unhandled HResult=-2146234304 Message=Could not load file or assemb

我已经为Visual Studio和.NET Connector(6.7.4.0)安装了MySQL.我之前安装了6.6.5.0.为什么还在寻找这个DLL?

System.IO.fileLoadException was unhandled  HResult=-2146234304  Message=Could not load file or assembly 'mysql.data,Version=6.6.5.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)  Source=mscorlib  filename=mysql.data,PublicKeyToken=c5687fc88969c44d  FusionLog==== Pre-bind state information ===LOG: User = Vaughan-PC\Vaughan HiltsLOG: displayname = mysql.data,PublicKeyToken=c5687fc88969c44d (Fully-specifIEd)LOG: Appbase = file:///C:/Users/Vaughan Hilts/documents/GitHub/blastersgame/BlastersOnline/LobbyServer/bin/DeBUG/LOG: Initial PrivatePath = NulLCalling assembly : System.Data,Version=4.0.0.0,PublicKeyToken=b77a5c561934e089.===LOG: This bind starts in default load context.LOG: Using application configuration file: C:\Users\Vaughan Hilts\documents\GitHub\blastersgame\BlastersOnline\LobbyServer\bin\DeBUG\LobbyServer.vshost.exe.ConfigLOG: Using host configuration file: LOG: Using machine configuration file from C:\windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.LOG: Post-policy reference: mysql.data,PublicKeyToken=c5687fc88969c44dLOG: Attempting download of new URL file:///C:/Users/Vaughan Hilts/documents/GitHub/blastersgame/BlastersOnline/LobbyServer/bin/DeBUG/mysql.data.DLL.WRN: Comparing the assembly name resulted in the mismatch: Minor VersionERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.  StackTrace:       at System.RuntimeTypeHandle.GetTypeByname(String name,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly,StackCrawlMarkHandle stackMark,IntPtr pPrivHostBinder,Boolean loadTypeFromPartialname,ObjectHandleOnStack type)       at System.RuntimeTypeHandle.GetTypeByname(String name,StackCrawlMark& stackMark,Boolean loadTypeFromPartialname)       at System.RuntimeType.GetType(String typename,StackCrawlMark& stackMark)       at System.Type.GetType(String typename)       at System.Data.Common.DbProvIDerFactorIEs.GetFactory(DaTarow provIDerRow)       at System.Data.Common.DbProvIDerFactorIEs.GetFactory(String provIDerInvariantname)       at System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProvIDername(String provIDerInvariantname)       at System.Data.Entity.Internal.LazyInternalConnection.InitializefromConnectionStringSetting(ConnectionStringSettings appConfigConnection)       at System.Data.Entity.Internal.LazyInternalConnection.TryInitializefromAppConfig(String name,AppConfig config)       at System.Data.Entity.Internal.LazyInternalConnection.Initialize()       at System.Data.Entity.Internal.LazyInternalConnection.get_ProvIDername()       at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()       at System.Data.Entity.Internal.InternalContext.Initialize()       at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)       at System.Data.Entity.Internal.linq.InternalSet`1.Initialize()       at System.Data.Entity.Internal.linq.InternalSet`1.get_InternalContext()       at System.Data.Entity.Infrastructure.Dbquery`1.System.linq.Iqueryable.get_ProvIDer()       at System.linq.queryable.FirstOrDefault[TSource](Iqueryable`1 source)       at LobbyServer.Lobby.Main(String[] args) in c:\Users\Vaughan Hilts\documents\GitHub\blastersgame\BlastersOnline\LobbyServer\Lobby.cs:line 64       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly,String[] args)       at System.AppDomain.ExecuteAssembly(String assemblyfile,EvIDence assemblySecurity,String[] args)       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx)       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,Object state)       at System.Threading.ThreadHelper.ThreadStart()  InnerException: 
最佳答案您可以使用绑定重定向来解决此错误.绑定重定向是一种框架功能,它允许您指示对该特定程序集的任何请求(由版本/公钥标记等标识)应该由该程序集的另一个版本提供服务.

所以你应该在和下添加一个节点.在这里,它应该是什么样子;

请注意,publicKeyToken,文化信息可以在exeception中找到(代码中出现异常,因为它基于您上面的异常信息).

附:
请记住,如果这些版本之间存在任何实际的界面差异,您可能会因为我们所期望的不匹配而最终获得例外,但通常大多数提供商都不会破坏主要版本以外的内容,因此我们不会通常会看到这样的问题:) 总结

以上是内存溢出为你收集整理的c# – 无法加载“MySql.Data”或其中一个依赖项.全部内容,希望文章能够帮你解决c# – 无法加载“MySql.Data”或其中一个依赖项.所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1166611.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)