Visual Studio 2015 UNITY 项目中的参考 System.Data [英] Reference System.Data in Visual Studio 2015 UNITY project

查看:39
本文介绍了Visual Studio 2015 UNITY 项目中的参考 System.Data的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Visual Studio 用于我的 Unity 项目.(Unity 使用的是单声道框架,而不是 .net).我正在使用数据库,所以我必须在我保存在 Assets/Plugins 文件夹中的项目中使用 System.Data.dll:

I'm using Visual Studio for my Unity project. (Unity is using mono framework, NOT .net). I'm using a database so I have to use System.Data.dll in the project which i'm keeping in Assets/Plugins folder:

如您所见,Visual Studio 在查看 System.Data 库时出现问题.所以我硬编码:

As you can see Visual Studio has problems seeing System.Data library. So I'm hardcoding:

还有一些红线:

令人惊讶的是,我在 Unity 中没有任何错误,并且代码实际上可以运行:

Surprisingly, I have no errors in Unity and the code is actually working:

我在 VS 中也有这个烦人的黄色图标:

I also have this annoying yellow icon in VS:

你能帮我强制 Visual Studio 查看 System.Data 库吗?

Can you help me in forcing Visual Studio to see System.Data library please?

推荐答案

System.Data.dllSystem.MySql.dllSystem.Drawing.dll 应该全部放在 Assets 文件夹中,而不是 Assets/Plugin 文件夹中.进行这些更改可以避免错误.

The System.Data.dll, System.MySql.dll and System.Drawing.dll should all placed in the Assets folder not in the Assets/Plugin folder. Making these changes get ride of the error.

编辑:

System.Data.dll 添加到 Assets 文件夹应该可以正常工作,但会以静默方式失败.深入研究这个,我得到了这个错误:

Adding System.Data.dll to the Assets folder should work but is failing silently. Digging deeper into this, I got this error:

无法解析主要引用System.Data",因为它具有比当前目标中存在的更高版本2.0.5.0"框架.在当前目标框架中找到的版本是2.0.0.0".

The primary reference "System.Data" could not be resolved because it has a higher version "2.0.5.0" than exists in the current target framework. The version found in the current target framework is "2.0.0.0".

因此,System.Data.dll 版本与您的目标框架不同,这就是问题所在.您需要与目标框架 (2.0.0.0) 相同版本的 System.Data.dll 另一个版本.

So, the System.Data.dll version is different from your target framework and that is the problem. You need another version of System.Data.dll that is the-same version of your target framework(2.0.0.0).

您可以从以下位置获得兼容版本 (2.0.0.0):

You can get a compatible version(2.0.0.0) from:

C:Program Files (x86)ReferenceAssembliesMicrosoftFramework.NETFrameworkv3.5ProfileUnity Subsetv3.5

C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv3.5ProfileUnity Subset v3.5

这篇关于Visual Studio 2015 UNITY 项目中的参考 System.Data的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆