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

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

问题描述

我将Visual Studio用于Unity项目. (Unity使用的是Mono框架,而不是.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.dll System.MySql.dll System.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 版本与您的目标框架不同,这就是问题所在.您需要 System.Data.dll 的另一个版本,它是目标框架的相同版本(2.0.0.0).

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)\ Reference 程序集\ Microsoft \ Framework \ .NETFramework \ v3.5 \ Profile \ Unity子集 v3.5

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Unity Subset v3.5

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

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