views:

410

answers:

2

I've downloaded a C# Class Library called TreeViewAdv, that I need to use in another project as a COM DLL.

It builds successfully (Release, not Debug).

  • Registering the built DLL using "regasm" says "Types registered successfully"
  • Registering with "gacutil" says "Assembly successfully added to cache"

In the C# project settings:

  • Application > Assembly Information > Make assembly COM-Visible is checked
  • Build > Register for COM Interop is checked

When I attempt to add this built DLL to the VS via the "Choose Toolbox Items" dialog though, it says "Self-registration for XYZ.tlb failed."

Anything else I have to configure? Why can't I use this DLL in VS?

+2  A: 

I don't think it's enough to simply mark it as COM-Visible. You need to do a bit of work in your class design and code to make it behave correctly. This article walks you through creating a simple class

Conrad
A: 

Not to forget this post that steps you thru registering the class.

Jenko
@Jeremy,I also have the need to use TreeViewAdv as a COM component. Did you succeed in getting it to work in that manner? If so, do you have any pointers for me, or better yet, a COM-enabled DLL you could pass along?
Jeff Godfrey