HtmlAgilityPack - File Not found

asp.net c# html-agility-pack sharepoint visual-studio-2010

Question

I'm developing a C# ASP .NET WebPart in SharePoint Foundation.

Everything works fine, now I want to Parse a HTML Page to get all ImagePaths and save the Images on HD/Temp.

To do that I was downloading HtmlAgilityPack, current version, add reference to Project, everything looks OK, IntelliSense works fine.

But when I want to run the section where HtmlAgilityPack should be used my Browser shows me a

FileNotFoundException - The File or Assembly could not be found.

After first searches I tried to include v1.4.0 of HtmlAgilityPack because I read that the current version in some case is not really stable. This works fine to until the point I want to use HtmlAgilityPack, the same Exception.

I also tried moving the HtmlAgilityPack direct to the Solution directory, nothing changed.

I tried to insert HtmlAgilityPack via using and I tried direct call e.g. HtmlAgilityPack.HtmlDocument.

Conclusion :

  • When I compile no error occurs, the reference is set correct.

  • When I trace the HtmlAgilityPack.dll with ProcMon the Path is shown correct, but sometimes the Result is 'File Locked with only Readers' but I don't know enough about ProcMon to Know what this means or if this is critical. It couldn't have something to do with File Permissions because if I check the DLL the permissions are all given.

Popular Answer

I used HTML agility with this combination and it worked perfectly for me. Please try to check below and confirm.

  • Version of the DLL downloaded should support your solution.
  • Make sure to place a copy in GAC.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why