On Windows Phone

Topics: User Forum
Jul 31, 2012 at 9:41 AM

For the benefit of others.  This should be included in the docs somehow.

I used NuGet to install Html Agility Pack into my Windows Phone project and it added HtmlAgilityPack.dll as a reference. However compiling gave the following error:

error CS0012: The type 'System.Xml.XPath.IXPathNavigable' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml.XPath, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 

There is no such assembly provided for Windows Phone. However one can add a Silverlight version of that assembly, e.g. from

c:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Xml.XPath.dll

Adding the reference gives a warning, see below.  There is no error at runtime however and the code works are expected.  (Presumably an app using it passes certification but I haven't published using this.)

We can see that it is referenced this way in the HapPhone.7.1.csproj project:

<Reference Include="System.Xml.XPath">
   <HintPath>..\..\..\..\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Xml.XPath.dll</HintPath>

Oct 9, 2013 at 1:59 PM
The problem is due to HtmlAgiliyPack version. This issue can be solve by downloading suitable HtmlAgiliyPack varsion for the project from Nuget