You must add a reference to assembly System.Xml

D

Dariusz Tomon

Hello

I upgraded my project from Visual Studio 2003 to 2005. The upgrade was
performed with no errors but now when I try to build my project (now it's in
..NET 2.0 not .NET 1.1 as was previously) I always get the following error:

Error 1 The type 'System.Xml.Serialization.IXmlSerializable' is defined in
an assembly that is not referenced. You must add a reference to assembly
'System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
C:\Inetpub\wwwroot\EuroAdresPanels\FirmaFree.cs 26 21 EuroAdresPanels

What is funny I have got a reference to System.XML.

Below is the snippet of my code (the problematic is a line with private
DataTable TKon;):

using System;

using System.Diagnostics;

//\gjo

using System.Text;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Xml;



namespace EuroAdresPanels

{


public class FirmaFree : System.Web.UI.WebControls.WebControl

{

private string NazwaFirmy = "";

private int id;

private DataRow[] RAdresy;

private DataTable TKon;

private DataTable TWoj;

private string emial = "";

//gjo

private DataTable TBranze;

private DataTable TSlowa;

//flaga mowiaca czy wyswietlamy tylko jedna firmy

public bool IsAlone = false;

//\gjo

public string ConnString = null;

public FirmaFree(int idfirmy, DataRow[] rAdresy, DataTable Kontakty,
DataTable TWojewodztwo, string miasto, int woj)

{

id = idfirmy;

TWoj = TWojewodztwo;

TKon = Kontakty;

RAdresy = rAdresy;

this.IsAlone = false;

this.TSlowa = null;

this.TBranze = null;

}



public FirmaFree(int idfirmy, DataRow[] rAdresy, DataTable Kontakty,
DataTable TWojewodztwo,

string miasto, int woj, DataTable TBranze, DataTable TSlowa, string
ConnString)

{

id = idfirmy;

TWoj = TWojewodztwo;

TKon = Kontakty;

RAdresy = rAdresy;

this.IsAlone = true;

this.TSlowa = TSlowa;

this.TBranze = TBranze;

this.ConnString = ConnString;


// this.IsAlone = SprawdzMaxBranz();

}



Any ideas how to deal with it?

Best Regards

Darek T.
 
G

Guest

Dariusz,
Having a "using System.Xml" directive is not the same as having a reference.
For that, you must use the Add Reference item from Solution Explorer, and
explicitly choose the assembly System.Xml from the .NET Tab list.
Peter
 
T

Teemu Keiski

Hi,

using System.Xml;

does *not* mean you'd have reference to System.Xml.dll assembly. It means
you are just importing that namespace, trying to shortcut the need to type
fully-qualified names of types residing in System.Xml namespace.

Namespaces are logical concepts, and they don't necessarily always go hand
in hand with assemblies. For example: System.Configuration namespace spans
two assemblies: System.dll and System.Configuration.dll

So, try taking the reference in VS with Add reference dialog (/right-click
project in solution explorer)


--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net


Dariusz Tomon said:
Hello

I upgraded my project from Visual Studio 2003 to 2005. The upgrade was
performed with no errors but now when I try to build my project (now it's
in .NET 2.0 not .NET 1.1 as was previously) I always get the following
error:

Error 1 The type 'System.Xml.Serialization.IXmlSerializable' is defined in
an assembly that is not referenced. You must add a reference to assembly
'System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
C:\Inetpub\wwwroot\EuroAdresPanels\FirmaFree.cs 26 21 EuroAdresPanels

What is funny I have got a reference to System.XML.

Below is the snippet of my code (the problematic is a line with private
DataTable TKon;):

using System;

using System.Diagnostics;

//\gjo

using System.Text;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Xml;



namespace EuroAdresPanels

{


public class FirmaFree : System.Web.UI.WebControls.WebControl

{

private string NazwaFirmy = "";

private int id;

private DataRow[] RAdresy;

private DataTable TKon;

private DataTable TWoj;

private string emial = "";

//gjo

private DataTable TBranze;

private DataTable TSlowa;

//flaga mowiaca czy wyswietlamy tylko jedna firmy

public bool IsAlone = false;

//\gjo

public string ConnString = null;

public FirmaFree(int idfirmy, DataRow[] rAdresy, DataTable Kontakty,
DataTable TWojewodztwo, string miasto, int woj)

{

id = idfirmy;

TWoj = TWojewodztwo;

TKon = Kontakty;

RAdresy = rAdresy;

this.IsAlone = false;

this.TSlowa = null;

this.TBranze = null;

}



public FirmaFree(int idfirmy, DataRow[] rAdresy, DataTable Kontakty,
DataTable TWojewodztwo,

string miasto, int woj, DataTable TBranze, DataTable TSlowa, string
ConnString)

{

id = idfirmy;

TWoj = TWojewodztwo;

TKon = Kontakty;

RAdresy = rAdresy;

this.IsAlone = true;

this.TSlowa = TSlowa;

this.TBranze = TBranze;

this.ConnString = ConnString;


// this.IsAlone = SprawdzMaxBranz();

}



Any ideas how to deal with it?

Best Regards

Darek T.
 
D

Dariusz Tomon

Peter,

As I wrote I had the reference (in the solution explorer). I had also it in
using clause.
My problem was about having to projects in my solution and I had reference
in the wrong project. Now I added reference to the right one and it works as
expected.
Thank you very much.

Darek T.


Peter Bromberg said:
Dariusz,
Having a "using System.Xml" directive is not the same as having a
reference.
For that, you must use the Add Reference item from Solution Explorer, and
explicitly choose the assembly System.Xml from the .NET Tab list.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Dariusz Tomon said:
Hello

I upgraded my project from Visual Studio 2003 to 2005. The upgrade was
performed with no errors but now when I try to build my project (now it's
in
..NET 2.0 not .NET 1.1 as was previously) I always get the following
error:

Error 1 The type 'System.Xml.Serialization.IXmlSerializable' is defined
in
an assembly that is not referenced. You must add a reference to assembly
'System.Xml, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
C:\Inetpub\wwwroot\EuroAdresPanels\FirmaFree.cs 26 21 EuroAdresPanels

What is funny I have got a reference to System.XML.

Below is the snippet of my code (the problematic is a line with private
DataTable TKon;):

using System;

using System.Diagnostics;

//\gjo

using System.Text;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using System.Xml;



namespace EuroAdresPanels

{


public class FirmaFree : System.Web.UI.WebControls.WebControl

{

private string NazwaFirmy = "";

private int id;

private DataRow[] RAdresy;

private DataTable TKon;

private DataTable TWoj;

private string emial = "";

//gjo

private DataTable TBranze;

private DataTable TSlowa;

//flaga mowiaca czy wyswietlamy tylko jedna firmy

public bool IsAlone = false;

//\gjo

public string ConnString = null;

public FirmaFree(int idfirmy, DataRow[] rAdresy, DataTable Kontakty,
DataTable TWojewodztwo, string miasto, int woj)

{

id = idfirmy;

TWoj = TWojewodztwo;

TKon = Kontakty;

RAdresy = rAdresy;

this.IsAlone = false;

this.TSlowa = null;

this.TBranze = null;

}



public FirmaFree(int idfirmy, DataRow[] rAdresy, DataTable Kontakty,
DataTable TWojewodztwo,

string miasto, int woj, DataTable TBranze, DataTable TSlowa, string
ConnString)

{

id = idfirmy;

TWoj = TWojewodztwo;

TKon = Kontakty;

RAdresy = rAdresy;

this.IsAlone = true;

this.TSlowa = TSlowa;

this.TBranze = TBranze;

this.ConnString = ConnString;


// this.IsAlone = SprawdzMaxBranz();

}



Any ideas how to deal with it?

Best Regards

Darek T.
 
S

sloan

If you already have the REFERENCE (not just the "using" statement)
Remove the Reference .. and re-add it.

Sometimes that'll clear it up.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top