Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Support multiple assembly versions

Support multiple assembly versions

Scheduled Pinned Locked Moved C#
questionjsonhelpannouncement
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joseph LeBlanc
    wrote on last edited by
    #1

    Hello, I have an application that references a particular assembly that contains the Windows Media Center Click-To-Record API (Windows\eHome\ehRecObj.dll). The problem is that when my application runs on Vista this assembly is version 6.0.6000.0 and when it runs on MCE 2k5 the version of this assembly is 5.1.2710.2732. My development machine is running Vista, so when I add a reference to this assembly to my project it's to the 6.0.6000.0 version. This results in my application crashing when I run it on MCE 2k5 with a "could not load file or assembly" exception because that particular version of that assembly does not exist on MCE 2k5. What do I need to do to my project so that my application will work with either version of the ehRecObj assembly? I've searched for documentation but since I don't understand assembly versioning very well I can't quite seem to find anything that answers my question.

    Joseph LeBlanc

    M 1 Reply Last reply
    0
    • J Joseph LeBlanc

      Hello, I have an application that references a particular assembly that contains the Windows Media Center Click-To-Record API (Windows\eHome\ehRecObj.dll). The problem is that when my application runs on Vista this assembly is version 6.0.6000.0 and when it runs on MCE 2k5 the version of this assembly is 5.1.2710.2732. My development machine is running Vista, so when I add a reference to this assembly to my project it's to the 6.0.6000.0 version. This results in my application crashing when I run it on MCE 2k5 with a "could not load file or assembly" exception because that particular version of that assembly does not exist on MCE 2k5. What do I need to do to my project so that my application will work with either version of the ehRecObj assembly? I've searched for documentation but since I don't understand assembly versioning very well I can't quite seem to find anything that answers my question.

      Joseph LeBlanc

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! I guess ehRecObj.dll is hosting a COM type library, right? In order to support different versions I think the best way (at least the one I use) is to take the dll with the lowest version (that's still supporting the functionality you need) and create an interop assembly "by hand". There's a tool named "tlbimp" included in the .NET SDK that can create such interop assemblies. In your .NET application you only reference the interop assembly (instead of adding a reference to the COM type library). At runtime, the calls to your interop assembly's classes are marshaled to calls to the actual COM objects installed on the target system.

      Regards, mav -- Black holes are the places where God divided by 0...

      J 1 Reply Last reply
      0
      • M mav northwind

        Hi! I guess ehRecObj.dll is hosting a COM type library, right? In order to support different versions I think the best way (at least the one I use) is to take the dll with the lowest version (that's still supporting the functionality you need) and create an interop assembly "by hand". There's a tool named "tlbimp" included in the .NET SDK that can create such interop assemblies. In your .NET application you only reference the interop assembly (instead of adding a reference to the COM type library). At runtime, the calls to your interop assembly's classes are marshaled to calls to the actual COM objects installed on the target system.

        Regards, mav -- Black holes are the places where God divided by 0...

        J Offline
        J Offline
        Joseph LeBlanc
        wrote on last edited by
        #3

        ehRecObj actually isn't COM, it's a managed API.

        Joseph LeBlanc

        M 1 Reply Last reply
        0
        • J Joseph LeBlanc

          ehRecObj actually isn't COM, it's a managed API.

          Joseph LeBlanc

          M Offline
          M Offline
          mav northwind
          wrote on last edited by
          #4

          Oh, in that case you can specify (at least in VS 2005) that the reference doesn't require a specific version in the reference's properties.

          Regards, mav -- Black holes are the places where God divided by 0...

          J 1 Reply Last reply
          0
          • M mav northwind

            Oh, in that case you can specify (at least in VS 2005) that the reference doesn't require a specific version in the reference's properties.

            Regards, mav -- Black holes are the places where God divided by 0...

            J Offline
            J Offline
            Joseph LeBlanc
            wrote on last edited by
            #5

            That's the kind of solution I'm looking for, I just can't figure out how to do it. I'm using Visual C# 2008 Express and I can't find any settings that let me configure how the assembly is referenced in my project. I looked at my .csproj file and where I reference that assembly there's a line "<SpecificVersion>False</SpecificVersion>". I've never changed that setting so I don't think that's the reason.

            Joseph LeBlanc

            M 1 Reply Last reply
            0
            • J Joseph LeBlanc

              That's the kind of solution I'm looking for, I just can't figure out how to do it. I'm using Visual C# 2008 Express and I can't find any settings that let me configure how the assembly is referenced in my project. I looked at my .csproj file and where I reference that assembly there's a line "<SpecificVersion>False</SpecificVersion>". I've never changed that setting so I don't think that's the reason.

              Joseph LeBlanc

              M Offline
              M Offline
              mav northwind
              wrote on last edited by
              #6

              You see it's not easy trying to help you if every relevant piece of information has to be extracted bit by bit... I don't have any experience with VS 2008 yet, so I'm sorry I can't help you any further...

              Regards, mav -- Black holes are the places where God divided by 0...

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups