Saturday, November 01, 2008

Silverlight Version

One nifty utility that I've been using for a long time but never got around to publishing is a Silverlight version detector which will tell you the full version that you have installed on your machine. It really isn't that hard to do, but the nice thing about this one is that I've been using it on Silverlight versions way back to before 1.0 was released and the product was still called WPF/E.

I primarily use this code for times when someone calls me up with a problem along the lines of 'something is running wacky on my machine'. It's much easier to just point them to a URL than to list the steps needed to find their version other ways.

Please note that this code is *not* the way that you're supposed to check whether the user has a version installed or not, that's what IsVersionSupported is for. The reason for this is that everyone seems to add bugs when trying to roll their own version detection code, so in the interest of making sure that your code continues to work through future updates, please use IsVersionSupported.

To use IsVersionSupported: Application.Current.Host.IsVersionSupported("2.0.31005.0");

Finally got around to updating a couple of Silverlight samples from older versions, only took me a few weeks :)

Updated samples: