Search code examples
c#windows-phone-8windows-phonewindows-phone-8.1html-agility-pack

windows phone 8 htmlagilitypack not found when building (intellisense works)


I'm trying to use HTML AGILITY PACK (HAP) in my Windows Phone 8/8.1 C# .NET 4.5 project.

I added it using nuget console (by typing Install-Package htmlagilitypack and it added fine to the project.

Then I added the html agility pack to References ( the version included in packages\HtmlAgilityPack.1.4.9\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid+MonoTouch in the project folder) and it added withnout trouble.

After that i proceeded and wrote using HtmlAgilityPack; into the page and started writing my code, intellisense found everything and it seemed ok.

But when I tried to build/rebuild/clean+build solution, I got an error stating Error 1 The type or namespace name 'HtmlAgilityPack' could not be found (are you missing a using directive or an assembly reference?) C:\Users\XXX\Documents\XXXX\Pages\SomePage.xaml.cs 9 22 XXXX

What is wrong?


Solution

  • I don't really know what is wrong, but I've had this issue as well since the updates to HAP this past fall. I've found that downgrading to version 1.4.6 solves this problem for me.

    From the Package Manager Console:

    Uninstall-Package HtmlAgilityPack
    

    Then

    Install-Package HtmlAgilityPack -Version 1.4.6
    

    Hope that helps.