Referencing the HtmlAgilityPack

Topics: Customizing Orchard, Writing modules
May 21, 2013 at 1:27 PM
I'm creating a module that will enable Html to be passed and markup generate for picturefill. I'm using the HtmlAgilityPack to find and replace the relevant tags and in a non Orchard project this works fine.

Once the code is in Orchard I add the reference to the file, but when I run it if can't find the assembly.

Should Orchard just pick it up from the reference or do I need to do something extra?

May 21, 2013 at 7:11 PM
Edited May 21, 2013 at 7:12 PM
If you add a reference to the dll in your module project, orchard should pick it and copy it to orchard.web\app_data\dependencies so that the assembly can be found in runtime.

Can you see HtmlAgilityPack.dll in orchard.web\app_data\dependencies? If not, you can delete dependencies folder to force orchard to recreate it. You can also check if dependencies.xml in the same directory contains the reference.
May 21, 2013 at 9:09 PM
Ok so this works on my dev version, but not on my live site.

So to test it I have build the distro from the source and copied the files from App_Data and from the Media folder from my dev source it the staging code and stuck it into IIS but still got the YSOD on that.

Any ideas?
May 26, 2013 at 6:56 AM
Where did you put the dll?
Jun 7, 2013 at 7:40 AM
I had the same problem like @roly445.

I found HtmlAgilitiPack.dll in orchard.web\app_data\dependencies. However, when I run, it rose error:
Could not load file or assembly 'HtmlAgilityPack, Version=, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
What should I do now ?
Jun 7, 2013 at 7:52 AM
The only time I have seen this is if you have two versions and one of the modules relies on one version and another module relies on another.