问题
How can I use XPathSelectElement
in a portable class library? When I try to include System.Xml.XPath
assembly in the project, I get the following error:
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'.
My portable class libraries already have a reference to System.Xml.Linq
.
回答1:
Unfortunately, MSDN is showing that, as of .NET 4.5, these extension methods are not supported in Portable Class Libraries. If they were supported, they would display a

回答2:
Because XPathSelectElement
is declared in System.Xml.Linq.dll
, you should also reference it.
More details can be found here.
来源:https://stackoverflow.com/questions/20651431/include-xpathselectelement-in-portable-class-library