簡體   English   中英

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

[英]XmlDocument not available in Visual Studio 2012 DLL build

使用visual Studio 2012創建一個可移植類庫項目,我想使用XmlDocument類。 但是,即使有

using System.Xml;

錯誤消息是:

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

如果我右鍵單擊“引用”->“添加引用”,瀏覽到dll目錄(下面的地址),然后選擇以下dll:

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

然后單擊確定,出現錯誤

"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."

因此,一種解決方法是使用開源XML解析庫。 有什么建議么 ? Xerces?

但是,最好使用內置的C#XmlDocument類。

實際上, XmlDocument並非在所有框架上都可用,因此可能在PCL中不可用(取決於您選擇的框架選項)。 但是,較新的XDocument通常 -如有必要,請嘗試添加對System.Xml.Linq.dll的引用。

PCL的全部要點是,它限制了您在所有選定框架上都可以使用的組件的嚴格子集。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM