tags:

views:

126

answers:

3

I'm developing an XBAP (Partial trust) application, with multiple (~100) users.

In the next version the prerequisites have been bumped from framework 3.0 to framework 3.5, and we need an easy way to detect the framework version of each client machine, and advise them on whether they need to upgrade or not.

Any ideas or suggestions on how to do this?

+1  A: 

This is going to depend on when and where you are going to be distributing. If they are going to be downloading the application you can use this route to setup an ASP.NET page to warn them and even prevent download until they install it.

Otherwise, you would need to look at the registry on the users machine to determine if they have the proper versions. There is another SO question that covers this "How to detect what .NET Framework Version is Installed?"

Mitchel Sellers
Worth mentioning that the method linked to is not guaranteed to work with browsers other than IE.
Peter Lillevold
We're going to do the javascript/useragent thing from MSDN, as we don't have access to the registry from an xbap in partial trust, and don't want to have to distribute another application to do the check. We'll just take the support calls from the (probably _very_ few) users not on IE.
hhravn
A: 

Have you considered Environment.Version

  int buildVersion = Environment.Version.Build;
  int majorVersion = Environment.Version.Major;
  int minorVerdion = Environment.Version.Minor;
Asad Butt
+1 Good one! It's so easy!
Obalix
This wont work, as it returns the version of the CLR. As the CLR didn't change between framework 2.0, 3.0 and 3.5 the reported version would be 2.0, build 50727.
hhravn
+1  A: 

Take a look at this posting of Scott Hanselman and this link

crauscher