daiyue
daiyue

Reputation: 7448

how to reference a .net coded library in a MFC dialog-based project

I want to use Html Agility Pack which is in a .NET code library. Anyone knows how to import/reference the dll file into my vc++ MFC project?

I tried right clicking on my project, choose "References...", then I click the "Add new Reference" button, and I get an empty dialog box with a single tab "Projects" which contains an empty list.

Upvotes: 1

Views: 664

Answers (1)

Stu Mackellar
Stu Mackellar

Reputation: 11638

You can't call .Net code directly from unmanaged native code. You have several options if you want to do this indirectly though:

  1. Convert your MFC project to be mixed-mode
  2. Add an intermediate façade assembly
  3. Expose htmlagilitypack via COM (if you have access) and call it via COM interop

You need to provide more context if you want a recommendation on which approach might suit your circumstances best

Upvotes: 2

Related Questions