2
Vote

Crash on startup using HtmlAgilityPack from Nuget in WP7 project

description

Hello,
I have created a WP7 project (OS 7.1) in Visual Studio 2010.
Using Nuget I have installed HtmlAgilityPack and now I have the referenced DLL from the folowing path <myProjectDir>\packages\HtmlAgilityPack.1.4.3\lib\sl4-windowsphone71\HtmlAgilityPack.dll.
In the MainPage constructor I simple have the following line of code :
 
HtmlWeb htmlWeb = new HtmlWeb();
 
with using HtmlAgilityPack; on top.
When I run the app, the MainPage constructor isn't called and the app crashes so the App.cs method RootFrame_NavigationFailed is executed. The exception is the following "TargetInvocationException" and
System.TypeLoadException: Could not load type 'HtmlAgilityPack.HtmlWeb' from assembly 'HtmlAgilityPack, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
 
Why ?
 
Thanks,
Paolo.

comments

DarthObiwan wrote Jun 12, 2012 at 10:53 PM

That is strange, I just tried referencing 1.4.3 and tried the same thing and it worked perfectly.

The stranger thing is it says Version=1.0.0.0 as if the reference didn't take well.

elongxu wrote Feb 1 at 3:31 AM

add reference "C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Xml.XPath.dll"