Getting a compile error in c# about not referencing System.XML, yes System.XML is being reference

前端 未结 3 763
感动是毒
感动是毒 2020-12-20 23:17

I am trying to add a new feature to an old program I wrote. However, when trying to get the program to build in VS express it spits back an error message to me.

相关标签:
3条回答
  • 2020-12-20 23:41

    Using a namespace does not mean you referenced something. You need to add a reference to System.XML.

    If you are using Visual Studio, right click on references, click Add Reference and then select System.XML.

    0 讨论(0)
  • 2020-12-20 23:45

    The error may be misleading if you have the reference - you may also need to reference System.Xml.Serialization.

    0 讨论(0)
  • 2020-12-20 23:51

    The using directive (not to be confused with the using statement) is just to import namespaces from your referenced assemblies into your code file in order to make it easier to use the types that the assemblies contain without having to fully-qualify their names with their namespaces. The fact that the assembly System.Xml and the namespace System.Xml are named the same, in this case, is merely a coincidence.

    You need to actually add the System.Xml.DLL reference, as it suggests, to your project: right-click on "References" beneath your project in the solution explorer, select "Add Reference", then locate and check off the System.Xml assembly within the list of framework assemblies:

    0 讨论(0)
提交回复
热议问题