Rhyous

April 22, 2010

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

Filed under: C# (C-Sharp) — J. Abram barneck @ 3:56 pm
Tags: ,

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.

Advertisements

1 Comment »

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

    Pingback by How to get your project's version dynamically in C#? « Rhyous's … | Source code bank — April 22, 2010 @ 8:05 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: