Versioning your Silverlight application

Posted by Corey on June 11, 2009 at 10:34 pm.

When writing an enterprise level application it’s critical to have a version number.  Whether it’s located on the help screen or in debug mode, this will save you so much heartache during QA.  The larger the project, the more dependent your team is on the version.

Now that I’m all done ranting to the converted, let’s talk about Silverlight.  From my past experience there are two ways to handle versioning:

  1. Create an abstracted file that contains your version number, or
  2. Use the Assembly version.

Both have their pros and cons.  Option 1 gives you greater control of the version number, however the manual process is tedious.  Option 2 enables you to use the Assemblies version, however it provides less control over the version number.  Lately I’ve been going with option 2 because it takes one more step out of my deployment process.

To get the version from the Assembly

Doing this is fairly easy once you have the correct block of code.  The below block of code shows how to get the version from the Assembly in the MainPage_Loaded method.  Do not forget to include the System.Reflection reference.

image

Given the above block of code, the next question is, where is this assembly version defined?  In short, the AssemblyInfo.cs file, which is located in the Properties folder.

image

At the bottom of the AssemblyInfo.cs file, you’ll see the version info.  The directions are in the comments on how to change this.  I’ve customized my version to be 0.611.*.

image

Related posts:

  1. Resize Silverlight 1.0 app to size of browser
  2. Set the source for an image from C#
  3. Why won’t media play in Silverlight 2?
  4. Simple Perspective 3D in Silverlight 3
  5. Favorite Visual Studio 2008 keyboard shortcuts

10 Responses to “Versioning your Silverlight application”