Getting a compilation error in C # about the lack of a link to System.XML, yes System.XML is a link

I am trying to add a new function to an old program that I wrote. However, trying to get the program to build VS, it returns an error message to me.

Error 1 Type "System.Xml.Serialization.IXmlSerializable" - this is defined in an assembly that is not referenced. You must add a reference to the assembly 'System.Xml, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089. C: \ Path \ To \ File \ summaryForm.cs 101 18 SerialController

However, the thing is at the top of the cs file, it has

using System; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; using System.Xml; 

Any ideas why they don't recognize the XML link?

+4
source share
3 answers

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

If you are using Visual Studio, right-click the links, click Add Link, and then select System.XML .

+17
source

The using directive (not to be confused with using ) is to import the namespaces from your reference assemblers into your code file in order to simplify the use of the types contained in assemblies without fully qualifying their names with their namespaces. The fact that the System.Xml assembly and the System.Xml namespace System.Xml called the same in this case is just a coincidence.

You need to add the System.Xml.DLL link, as it suggests, to your project: right-click the "Links" link under your project in the solution explorer, select "Add Link", then find and open System.Xml in the list of frame collectors :

enter image description here

enter image description here

+9
source

The error can be misleading if you have a link - you may also need a System.Xml.Serialization link.

System.Xml.Serialization library

+2
source

All Articles