Hi!
I know mono has System.Data namespace, but unity can’t compile and it give me the error “the type or namespace ‘System.Data’ could not be found”.
How can I add the reference?
Upgrade to Unity 1.6.1.
I did it, maybe I have to reimport all assets?
I’ll try this night.
You don’t need to recompile your assets. Just use using namespace System.Data;
or import System.data in js.
It doesn’t work.
I have created a new project and typed this code
using System;
using System.Data;
using System.Collections;
using UnityEngine;
public class Test
{
public string fileName;
void Start()
{
DataSet ds = new DataSet();
ds.ReadXml(filename);
}
}
The error is
Assets/Test.cs(2) error: The type or namespace name ‘Data’ does not exist in the namespace ‘System’.Are you missing an assembly reference?
Unity version: 1.6.1 build 6908 - pro
For now:
Open /Applications/Unity/Unity.app/Contents/Frameworks/MonoCompiler.framework/compile_any.pl
replace line 111 with:
my @base_args=($mono_path, $mcs_path, ‘-debug’, ‘-r:System.Data.dll’, ‘-target:library’, ‘-nowarn:0169’, ‘-out:’.$output, );
I’ve been getting the same error and was wondering if this is still the solution for this as the thread is 5 years old now. Thanks!
4 years and some versions later… in Unity 5
Go to Project Settings > Player and change API Compatibility Level from .Net 2.0 Subset to full .Net 2.0.