By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,559 Members | 1,180 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,559 IT Pros & Developers. It's quick & easy.

You must add a reference to assembly System.Xml

P: n/a
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.
May 11 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" wrote:
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.
May 11 '07 #2

P: n/a
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" <d.*****@mazars.plwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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.
May 11 '07 #3

P: n/a
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 [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:9D**********************************@microsof t.com...
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" wrote:
>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.

May 11 '07 #4

P: n/a

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

Sometimes that'll clear it up.


"Dariusz Tomon" <d.*****@mazars.plwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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.


May 11 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.