如何在便攜式類庫中使用XPathSelectElement
?當我嘗試包括System.Xml.XPath
組裝項目,我得到以下錯誤:在便攜式類庫中包含XPathSelectElement
The type 'System.Xml.Linq.XElement' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml.Linq, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
我的便攜式類庫已經有一個參考System.Xml.Linq
。
我已經在項目中引用它,它仍然給出相同的錯誤。 – Shivangi
您是否使用'Parse'方法來獲取XElement的實例?如果是這樣,你可以嘗試這樣做:'(XDocument.Parse(str)as XDocument).XPathSelectElement'? – DarkWalker
是的,我使用Parse – Shivangi