简体   繁体   中英

XmlDocument not available in Visual Studio 2012 DLL build

Using visual Studio 2012, creating a Portable Class Library project, I would like to use the XmlDocument class . However the library is not being found, even with

using System.Xml;

The error message is:

"are you missing a using directive or an assembly reference"

If I right click on References -> "Add References", browse to the dll directory (address below), and select the following dll:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.XML.dll

Then click OK, an error appears

"A reference to 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.XML.dll' could not be added. 
This component is already automatically referenced by the build system."

So a work around is to use an open source XML parsing library. Any suggestions ? Xerces ?

But it would be preferable to use the built in C# XmlDocument class.

Indeed, XmlDocument is not available on all frameworks, hence may not be available in a PCL (depending on what framework options you have selected). However, the newer XDocument generally is - try adding a reference to System.Xml.Linq.dll if necessary.

The entire point of a PCL is that it restricts you to the strict subset of components available on all of the selected frameworks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM