1
votes

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:

enter image description here

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

enter image description here


And some more red lines:

enter image description here

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

enter image description here

I also have this annoying yellow icon in VS:

enter image description here

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

1
Inside your unity installation folder there should be a system.data. Replace the one in your project, with the one in your installation folder Path probably looks something similar to: C:\Program Files\Unity\Editor\Data\Mono\lib\mono\unityMX D
Yes, thanks, that's the library I'm using, I've re-imported it just in case but still the sameNika Kasradze

1 Answers

3
votes

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.

EDIT:

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

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".

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).

You can get a compatible version(2.0.0.0) from:

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