tags:

views:

373

answers:

3

I have a windows service that is instantiating a dcom object with a certain guid A.

I need to replace that dcom object with a new version. When I create and compile my replacement dcom object it is created with a guid B.

How do I change the replacement dcom object's guid from guid B to guidA?

+2  A: 

If you are trying to change the ID on the "server" side (the DLL or application that publishes that specific class), VB does that for you when you choose "no compatibility" in the project properties, "component" tab.

If you are trying to change which object is instantiated in a "client" (a DLL or application that uses a class published by another dll/app), then you need to change the reference (either through the references, or components, depending on what kind of object we are talking about) so that you point to the new version of the server (the one that publishes he class with the updated GUID). That means removing the current reference and adding a reference to the new server. Provided the names have not changed, everything else should still work as it did before, minor any change in the interface of the classes obviously.

You do not have direct access to the GUIDs in VB6, as far as I know.

Denis Troller
A: 

I managed to recompile my replacement DCOM object and have it use Guid A by ...

  1. Remove all references to Guid B from the registry
  2. delete my replacement DCOM object exe file
  3. Copy in the original DCOM exe file
  4. Rename the original DCOM exe file to the replacement name
  5. Recompile the vb project

I guess that when VB replaces the exe file, it looks for the GUID and then reuses that for recompiled version.

yamspog
A: 

You should compile your application (the replacement DCOM object) to be binary compatible with the existing dll, that way it will inherit the same GUID and the version number will increment. if you the over write the existing DCOM dll with the replacement everything should work.

For example, in VB6 you can specify binary compatibility in the projects dialogue settings. No sure where you set it for C++, i think the GUID's are imbeded in the source code.

Bigtoe