Managed code and the IVsHierarchy interface in VS7.1 (Everett)

In the VSIP Everett Extras release (currently in beta - see for more details) we've enabled managed code to more easily integrate into Visual Studio.  The problem is that there are some issues with VS's treatment of the IVsHierarchy interface that make managed implementations of the IVsHierarchy interfaces unusable.

The workaround to these issue is to write your IVsHierarchy implementation in native code.  The IVsHiearchy implementation is a thin wrapper that forwards all calls to your managed code.  The rest of your package can be managed also.  You'll need to handle the interop to get the native object created (using COM interop to treat the COM object as a .Net object), but that is all there is to it.  You can get quite far with a managed IVsHierarchy implementation, but eventually you'll find there are subtle problems with the Project Properties dialog and other issues that make your project not work at all.

So, avoid the problems altogether and stick with native code for your IVsHierarchy implementation.

In Whidbey, we plan for this to just go away.  As a matter of fact, in Whidbey we plan to make it easier than ever to create a custom project system in managed code.

Comments (3)

  1. Ben Fidge says:

    So it’s perfectly OK to implement a COM based IVsHierarchy in say, Delphi, and then have that delegate calls from the IDE to a managed hierarchy class?

    Do you have any examples of this in action?

  2. AllenD says:

    I don’t see why you couldn’t, but I’m not familiar with Delphi to know what the issues might be. I’m sorry that don’t have any samples of this.

    Good luck.


Skip to main content