How to get your project's version dynamically in C#?

Ok, so I wanted to create a little Help | About page that looks like this.

MyProgram 1.0.0.5

Author: Jared Barneck

Contributors: John, Mike, Mark, Tom, Bill, Jane, Ryan, Josh

I don’t really want to have to remember to change the version in the help file with each release, so I wanted to get the version dynamically.

Turns out that you can get the version as a string with a single line of code:

String theVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

Once you have the version as a string, you can display it how you want.

3 Comments

  1. I don't even know the way I ended up here, however I thought this publish used to be great. I do not understand who you're but certainly you're going to a famous blogger when you aren't already. Cheers!

  2. [...] How to get your project’s version dynamically in C#? | Rhyous Ok, so I wanted to create a little Help | About page that looks like this. [...]

  3. [...] the original post: How to get your project's version dynamically in C#? « Rhyous's … If you enjoyed this article please consider sharing [...]

Leave a Reply

How to post code in comments?

*