How Visual Basic Versions Your COM Objects

The good thing about VB is that it does almost everything for you; the bad thing about VB is that it does almost everything for you. What I mean is that sometimes it would be easier if the developers of VB let you take control of certain features. There are many times that I wish the toolbar had a button called Manual Mode that would let me take out the autopilot. Versioning is one of those categories in which VB’s help actually makes it harder for you.

The problem is that you never deal with GUIDs directly in VB. They are generated for you automatically when you compile your program or when you run your program in the debugger. Because of the nature of GUIDs (the fact that they are guaranteed to be unique), you must tell VB when it is appropriate to generate a new GUID or when it must keep the GUIDs the same. If VB were to change some crucial GUIDs, such as the IID of an interface, any client programs that depend on the GUID would stop working.

Visual Basic has three options that enable you to control how it generates GUIDs. (Remember that GUID generation occurs when you compile your server or when you run your server code in the debugger.) These three options produce four different configurations. You will find the three settings in the Project Properties dialog box, under the Component tab, as shown in Figure 6-1.

Version configurations

Figure 6-1. Version ...

Get COM+ Programming with Visual Basic now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.