This project has moved. For the latest updates, please go here.

Using HtmlAgilityPack from unmanaged C++?

Jan 5, 2010 at 5:30 PM

Hey all,

I'm trying to use the HtmlAgilityPack from unmanaged C++, and I'm just not having any luck. I started with the instructions listed at

I thought I was getting somewhere by adding [assembly: ComVisible(true)] to assemblyinfo.cs and rebuilding the project, but still no luck.

Has anyone used the HtmlAgilityPack with native C++? Any chance I can talk you into posting some instructions and/or an example?




Jan 5, 2010 at 5:34 PM

After setting it to comvisible you'll need to register the assembly as a COM object. you can use the regasm.exe program from .NET to do this. I should be in your windows folder. Mine is at C:\Windows\Microsoft.NET\Framework\v2.0.50727


Jan 5, 2010 at 5:35 PM

Another thing I would have to say is this library has not be optimized to be called through COM at all. There may be bugs due to marshaling or unsupported object types

Feb 20, 2011 at 6:33 AM


I'm trying to use the HtmlAgilityPack as COM object (in MS Word, Excel), register library:

>RegAsm.exe HtmlAgilityPack.dll /tlb 
>Assembly exported to '...\HtmlAgilityPack.tlb'

but HtmlAgilityPack.tlb is empty... no type, no class and etc.

When I unregister library

>RegAsm.exe HtmlAgilityPack.dll /u
>RegAsm : warning RA0000 : No types were un-registered

I right understand, that "... There may be bugs due to marshaling or unsupported object types" and HAP don't work as COM object?