c# - TypeLoadException - 如何继续

标签 c# mysql .net unity-game-engine mono

所以我尝试将依赖项加载到我的代码中,然后我得到:

TypeLoadException: Could not load type 'System.Data.SqlClient.SqlConnection' from assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. System.Reflection.MonoMethodInfo.GetMethodInfo (IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:59) System.Reflection.MonoMethodInfo.GetAttributes (IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:75) System.Reflection.MonoMethod.get_Attributes () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:245) System.Reflection.MethodBase.get_IsSpecialName () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:184) UnityEditor.Build.BuildPipelineInterfaces.InitializeBuildCallbacks (Boolean findBuildProcessors, Boolean findSceneProcessors) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:149)y

我使用的是单声道,所以这可能是原因吗?我真的不知道,因为这是我第一次尝试在 Unity 上使用数据库。

我该怎么做才能让它发挥作用?

最佳答案

您是否使用了 {ProgramFilesDir/x86}\Reference Assemblies\Microsoft\Framework.NETFramework\v3.5\Profile\Unity 配置文件之一中的 System.Data.dll(例如 Unity“子集”) v3.5") 文件夹?

你是否把它放在“Assets/**/Plugins”文件夹中?

错误告诉您,您正在使用您构建/运行(在其他环境中)应用程序的其他程序集版本进行开发。

关于c# - TypeLoadException - 如何继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44365472/

相关文章:

c# - 用于制作 linq anyFlags(MyFlag) 的标志和枚举

c# - 将字符串对象转换为 SqlString 时出现异常

php - 从我的表中删除数据时出现错误

mysql - 我们可以在SQL中对前期的总和进行分组吗

c# - 字典和哈希表之间的主要区别是什么

c# - 从程序集中获取所需的运行时版本

c# - 错误 : The type or namespace name 'ApplicationUser' could not be found in Visual Studio 2013

PHP MySQL 插入具有不同 ID 的多行

c# - 将 C++/CLI 转换为 C#

c# - 从 C++ 到 C# .Net Compact Framework 的结构转换问题