views:

53

answers:

3

I like to migrate a COM-Class from 2.0 to 4.0. Would you recommend also to generate new guids for the classes and a different ProgId?

The old Class would not be used anymore. I know I have to re-register the Class, for the new Path of the mscorlib.

MS-Access create an instance auf my COM-Server Class with CreateObject and my COM-Object load some other classes with DI (dot.net 2.0 and in future 4.0)

A: 

I don't see why you would change the Guid or the progid. It means you would have to recompile everything that this references.

As long as you stick to binary compatability, it doesn't matter what version of the framework the implementation of your contract is, it's simply that, an implementation detail.

casperOne
+5  A: 

You only have to use new GUIDs when the interface definition changes. When you keep them the same, your new COM server will replace the existing one. And client code that uses it doesn't have to be recompiled. When you do change them then they can live side-by-side but client code has to explicitly be recompiled to use the new one.

Note that the in-process side-by-side CLR version support in .NET 4.0 is relevant here. Your COM server can be used in a program that binds the .NET 4.0 CLR, even if the COM server still binds the 2.0 CLR. Technically you don't have to update it.

Hans Passant
Thanks for your response, the side-by-side tip is nice, because of my DI with NET 2.0. I have to change the installer because in the Registry there was the reference to 2.0.
Andreas Hoffmann
A: 

I migrated to DOT.net 4.0 and do some tests. DOT.net 4.0 can use 2.0 Assemblies, no problem for my DI Scenario.

The Only thing I have to do, is update my installer. The reason for this is, because the HKEY_CLASSES_ROOT\CLSID{COMGuid} controls witch Runtime Version it have to use.

"RuntimeVersion"="v4.0.30319"

Andreas Hoffmann