VisualStudio.Net Add-in written in Delphi
I'm planning to create a spin-off of UnCodeX (again), this is going to be an add-in for VisualStudio.Net. Right now Epic has a simple tool that gives a class and package tree, but compared to UnCodeX is kinda inferior. Since I have a lot of base code it would be easy to create an add-in right?
Well not completely, first the add-in creation is done via an wizard in VisualStudio, well great, but how would I do the same in Delphi?. The add-ins are all COM based, so I will have to import a type-library somewhere. The VS.Net wizard does all the base work, so I have a few pointers, like what interfaces I should implement. But I have no idea what type-libraries to import. After a long search and some pointers here and there I've found out how to create a Add-in for VS.Net in Delphi.
- Before you do anything you will first have to import and install the type libraries (to make things easier in the next few steps).
- Import and install the type library:
Microsoft Add-Iin Desginer
, the actual file is called:MSADDNDR.DLL
. - Import and install the type library:
Microsoft Development Environment 7.0
, the actual file is called:dte.olb
.
- Import and install the type library:
- Now create a new ActiveX library; nothing major here, you just need it.
- Now in your library create a new ActiveX Automation Object.
- Enter any name you like; different from your library name.
- You will now see the Type Library tool, select your library in the tree and open the
Uses
tab.- Right-click the list and "show all type libraries"
- Now select the same type libraries you previously installed.
- Now select the Automation Object you created (it's the one not prefixed with an
I
)- Select the
Implements
tab - Right click and add
_IDTExtensibility2
- Right click and add
AddIn
- If either one of these are not available you messed up in the previous steps.
- Select the
- Close the type library tool window.
- Save the new unit (Save all files i the project)
- Now add the following to the
interface
uses list:, EnvDTE_TLB, AddInDesignerObjects_TLB
- If everything is ok you should be able to compile the library.
- After the compile is done you should register the library via the menu
Run -> Register ActiveX Server
- Now you will have to add an entry to the registry so the add-in will show up in the Add-in manager. Add a new key to
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\Addins\
. The key name should be:<library name without extention>.<automation object name>
- The add-in should now be visible in the add-in manager
If you want to change the descript and version information in a later stage just open the .tlb
file in Delphi. This will pop-up the type library tool.
These are just the basics for a add-in, how the rest works is still a mystery, but I hope to solve it soon and report it here. Next thing might be how to add your own tool window, I assume this can done via an ActiveForm. The tool windows are refered to via the GUID in VisualStudio.NET, so it would be some more ActiveX\COM stuff.