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. Use AssemblyInfo?

Use AssemblyInfo?

Scheduled Pinned Locked Moved C#
helptutorialquestion
4 Posts 4 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.
  • R Offline
    R Offline
    RFickling
    wrote on last edited by
    #1

    Hi, The AssemblyInfo.cs file contains attributes, such as AssemblyVersion, which I want to use programatically, as in an About dialog. I have looked at the AssemblyVersionAttribute class, but I can't find any examples showing how to use it. Any help on this would be greatly appreciated. Thanks, Royce

    S D T 3 Replies Last reply
    0
    • R RFickling

      Hi, The AssemblyInfo.cs file contains attributes, such as AssemblyVersion, which I want to use programatically, as in an About dialog. I have looked at the AssemblyVersionAttribute class, but I can't find any examples showing how to use it. Any help on this would be greatly appreciated. Thanks, Royce

      S Offline
      S Offline
      Skynyrd
      wrote on last edited by
      #2

      Use System.Window.Forms.Application.ProductVersion

      1 Reply Last reply
      0
      • R RFickling

        Hi, The AssemblyInfo.cs file contains attributes, such as AssemblyVersion, which I want to use programatically, as in an About dialog. I have looked at the AssemblyVersionAttribute class, but I can't find any examples showing how to use it. Any help on this would be greatly appreciated. Thanks, Royce

        D Offline
        D Offline
        Dennis C Dietrich
        wrote on last edited by
        #3

        Hi Royce! The AssemblyInfo.cs file contains attributes, such as AssemblyVersion, which I want to use programatically, as in an About dialog. I suggest you should use the classes in the System.Reflection namespace rather than the ones from System.Windows.Forms because retrieving metadata from assemblies is exactly what the reflection classes were made for.

        Version MyVersion = Assembly.GetExecutingAssembly().GetName().Version;
        MessageBox.Show(MyVersion.ToString());

        Best regards Dennis

        1 Reply Last reply
        0
        • R RFickling

          Hi, The AssemblyInfo.cs file contains attributes, such as AssemblyVersion, which I want to use programatically, as in an About dialog. I have looked at the AssemblyVersionAttribute class, but I can't find any examples showing how to use it. Any help on this would be greatly appreciated. Thanks, Royce

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

          More generically (i.e. if you plan to use custom attributes or there is a possibility that you will be inspecting third party assemblies that may do so), you could do something like this: object[] attribs = Assembly.GetExecutingAssembly().GetCustomAttributes(true); That will return all of the custom attributes applied to the executing assembly either directly or through inheritance.

          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...’

          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