You must add a reference to assembly System.Xml

Discussion in 'ASP .Net' started by Dariusz Tomon, May 11, 2007.

  1. 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.
     
    Dariusz Tomon, May 11, 2007
    #1
    1. Advertising

  2. 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.
    >
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, May 11, 2007
    #2
    1. Advertising

  3. Dariusz Tomon

    Teemu Keiski Guest

    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" <> wrote in message
    news:%...
    > 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.
    >
     
    Teemu Keiski, May 11, 2007
    #3
  4. 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]" <> wrote in
    message news:...
    > 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.
    >>
    >>
    >>
     
    Dariusz Tomon, May 11, 2007
    #4
  5. Dariusz Tomon

    sloan Guest

    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" <> wrote in message
    news:%...
    > 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.
    >
    >
     
    sloan, May 11, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Prasanna Padmanabhan
    Replies:
    1
    Views:
    818
    Mattias Sjögren
    Nov 19, 2003
  2. babu dhayal via .NET 247

    How to add shared assembly in the add reference

    babu dhayal via .NET 247, Aug 5, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    6,228
    Nelson Xu
    Aug 17, 2004
  3. Greg Collins [MVP]
    Replies:
    5
    Views:
    5,607
    Anton Lapounov [MSFT]
    Aug 31, 2004
  4. Horatiu Margavan via .NET 247

    Assembly's manifest definition does not match the assembly reference.

    Horatiu Margavan via .NET 247, Aug 30, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,610
    Horatiu Margavan via .NET 247
    Aug 30, 2004
  5. Replies:
    5
    Views:
    618
    Vitaly
    Jan 28, 2007
Loading...

Share This Page