Dig Deeper Into VS.NET Add-Ins
Brian Noyes
Visual Studio Magazine
Written: August, 2002

Requires: VS.NET

The download code in this archive contains both VB and C# versions of the code for 
the subject article. The main project for the article is the InterfaceImplementer
Add-In for Visual Studio.NET. The project names have VB or CS attached to the end to
discriminate them.

To get the InterfaceImplementer up and running, you must first:
- Extract the files in this zip somewhere on your machine
- Open the InterfaceImplementerCS or InterfaceImplementerVB solution
- Compile both the Add-In project and the Setup project that is part of the soln
- Right click on the setup project and select Install. Follow the default prompts through
the setup process to get all the right registry settings in place for the add-in
- Re-Compile the main Add-In project. This re-registers the debug version of the 
Add-In as the current add in.

The InterfaceImplementer sample works as follows:
- If the Add-In is loaded (Use the Add-In Manager as discussed in the 
article to set the load state)
- And you then open a C# Project (If you create a new one, you will 
have to close, then reopen it to get the Open event to fire)
- You can open a class file and press the Add Interface button added to the Standard toolbar
- A Form will come up showing the interfaces available in the project
- Select an interface from the list and press the Implement Interface button. 
- You should see the interface declaration and methods get added to the C# class.

The VB version of the code does the same as the C#, but unfortunately, either one only currently
works for C# classes. The reason for this is that the CodeClass class includes methods to
add interfaces, methods, and so forth, but they only work for C#. To accomplish the same
thing for VB, you will have to write a bunch of additional code to manually insert the 
defintions in the class using the TextSelection and/or EditPoint classes that you can
get instances of from the CodeClass itself. There is some commented out code in the 
CodeImplementer class that shows the gist of how to do this.

I recommend you experiment by adding additional event handlers and trying to add VB implementation
capability. 

If you have any problems or questions running the code, please contact me at
brian@softinsight.com.

Enjoy!