none
How to support multiple version com poject RRS feed

  • Question

  •  using .net 2.0 sp1

     I have a com object that have 2 version, clients may install either 1 or both com object
     how can I detect the verison and choose the correct one to use in run time?

     I have tried to import both version com object into the reference but fail since it don't support the same type com object with 2 version at the some time.

    Any one have idea about this?

    thank you
    ClarkC
    Monday, February 2, 2009 7:02 AM

Answers

  • COM has the hard requirement that you change the [Guid] of the interface for a new version of the interface.  Now the problem is trivial, the client will get the version for which it was compiled.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Friday, February 6, 2009 2:56 PM
    Monday, February 2, 2009 11:30 AM
    Moderator

All replies

  • You can try to generate COM interop assemblies for both versions, and load them manually. You can used Activator.CreateComInstanceFrom method to load COM object dynamically from given assembly and call its methods dynamically too.
    • Proposed as answer by VASoftOnline Monday, February 2, 2009 8:51 AM
    • Unproposed as answer by nobugzModerator Monday, February 2, 2009 11:28 AM
    Monday, February 2, 2009 8:51 AM
  • COM has the hard requirement that you change the [Guid] of the interface for a new version of the interface.  Now the problem is trivial, the client will get the version for which it was compiled.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Friday, February 6, 2009 2:56 PM
    Monday, February 2, 2009 11:30 AM
    Moderator
  • How can I include both COM object in my program?

     


    ClarkC
    Tuesday, February 3, 2009 7:07 AM