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. Assembly version?

Assembly version?

Scheduled Pinned Locked Moved C#
csharptutorialquestionannouncement
6 Posts 3 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.
  • D Offline
    D Offline
    damir_tk
    wrote on last edited by
    #1

    How to get the assembly version in C#? I mean it is easy to get it for the assembly from which the code is executing by using the GetExecutingAssembly(), but how to get it for any other assembly? Thanks.

    T 1 Reply Last reply
    0
    • D damir_tk

      How to get the assembly version in C#? I mean it is easy to get it for the assembly from which the code is executing by using the GetExecutingAssembly(), but how to get it for any other assembly? Thanks.

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      Is the assembly loaded? If so, the current AppDomain should be able to retrieve it using GetAssemblies, in which case you could just check the version property. Otherwise, you could load it using Assembly.Load or Assembly.LoadFrom.

      The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

      D 1 Reply Last reply
      0
      • T turbochimp

        Is the assembly loaded? If so, the current AppDomain should be able to retrieve it using GetAssemblies, in which case you could just check the version property. Otherwise, you could load it using Assembly.Load or Assembly.LoadFrom.

        The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

        D Offline
        D Offline
        damir_tk
        wrote on last edited by
        #3

        Exactly my point. Now why in the Earth I need to load the whole assembly to get it version? Seems little bit clumsy, doesn't it?

        L T 2 Replies Last reply
        0
        • D damir_tk

          Exactly my point. Now why in the Earth I need to load the whole assembly to get it version? Seems little bit clumsy, doesn't it?

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          Look at the C# spec then to read the assembly manually. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

          1 Reply Last reply
          0
          • D damir_tk

            Exactly my point. Now why in the Earth I need to load the whole assembly to get it version? Seems little bit clumsy, doesn't it?

            T Offline
            T Offline
            turbochimp
            wrote on last edited by
            #5

            Clumsy? No, not really. My assumption was that you were interested in using the assembly in some way versus just inspecting its version. If all you want is the version, and nothing else, I would advise using the System.Diagnostics.FileVersionInfo class.

            The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

            D 1 Reply Last reply
            0
            • T turbochimp

              Clumsy? No, not really. My assumption was that you were interested in using the assembly in some way versus just inspecting its version. If all you want is the version, and nothing else, I would advise using the System.Diagnostics.FileVersionInfo class.

              The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

              D Offline
              D Offline
              damir_tk
              wrote on last edited by
              #6

              Yes, you are right. Thanks for your help.

              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