Reputation: 2948
I have two COM objects with different GUID
values, but the same name. One is a newer version of the other. What happens when I register both using Name.exe /regserver
? I've looked in the registry, and they both show up with the same ProgID
, but their respective GUID
values are different. They point to their separate locations on the hard drive. Is this a problem?
I'm trying to get the old version of a project to work alongside the new version of a project (but not running at the same time), and I think these two things are fighting.
The COM objects were created in VB6. The code that uses them is C#. They are added to their individual C# projects as references. When one is registered, I can't compile the other (nor run successfully).
What other information would be helpful while investigating this issue?
Upvotes: 2
Views: 476
Reputation: 942207
You are violating hard COM rules. Either your replacement must be an exact match with the component you replace. Or you must generate a new version that:
The best way to double-check all this is by running OleView.exe, File + View Typelib command. That decompiles the type library content back to IDL, you will see the guids and interfaces. If you want to create an exact substitute for the old component then everything must match exactly. Exact same guids, exact same interfaces with the exact same order of methods and exact same arguments.
Upvotes: 1
Reputation: 30408
Converting my comment into an answer:
You have created a new version of a component which is not backward compatible with the old version.
You really should change the ProgID
to indicate that this is effectively a new component. Client apps will have to explicitly target either the new component or the old one. People often just append a version number (e.g. 2
) to the ProgId
.
Upvotes: 1
Reputation: 10855
I haven't ever accessed VB6 ActiveX exes from .NET (just dlls), so this is a shot in the dark (and is weak enough to be just a comment except it is too long).
Perhaps you can create / export a .tlb each for the two VB6 components to compile your C# against. You shouldn't need the exes to compile.
Next manually add the registry entries as if they had separate Programmatic IDs (say MyComponent.ServerClass.1
and MyComponent.ServerClass.2
) and then load them by name in your C#.
Upvotes: 0