简体   繁体   English

XmlDocument在Visual Studio 2012 DLL生成中不可用

[英]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 . 使用visual Studio 2012创建一个可移植类库项目,我想使用XmlDocument类。 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: 如果我右键单击“引用”->“添加引用”,浏览到dll目录(下面的地址),然后选择以下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. 因此,一种解决方法是使用开源XML解析库。 Any suggestions ? 有什么建议么 ? Xerces ? Xerces?

But it would be preferable to use the built in C# XmlDocument class. 但是,最好使用内置的C#XmlDocument类。

Indeed, XmlDocument is not available on all frameworks, hence may not be available in a PCL (depending on what framework options you have selected). 实际上, XmlDocument并非在所有框架上都可用,因此可能在PCL中不可用(取决于您选择的框架选项)。 However, the newer XDocument generally is - try adding a reference to System.Xml.Linq.dll if necessary. 但是,较新的XDocument通常 -如有必要,请尝试添加对System.Xml.Linq.dll的引用。

The entire point of a PCL is that it restricts you to the strict subset of components available on all of the selected frameworks. PCL的全部要点是,它限制了您在所有选定框架上都可以使用的组件的严格子集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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