Applications and OS Version checking

I have been working on the Windows Application Compatibilty group for almost 5 years now, and the biggest hurdle we face is applications bind them selves to OS versions.

Firstly I see very little need of applications to check for OS version. Yes if the application has critical drivers or deals with data management I would feel they can check on the components and features availibility on which the app is dependent on.

Secondly if an OS version check is required it should always be version X or higher check as opposed to a lower bound check.

E.g.: I am guessing the apps code might be somewhere on the lines like:

 static private bool IsOSSupported()
{
OperatingSystem os = Environment.OSVersion;
Version vs = os.Version;
if ((vs.Major == 5) && (vs.Minor == 1))
{
return true;
}
else
{
MessageBox.Show("This version of the Operating System is not supported. The application requires Windows XP.", "Unsupported OS");
return false;
}
}

Now if you as an appdeveloper are doing the above as you are not sure if your app will work on the next release of windows, let me tell you, by doing the above you are gauranteeing failure :)

now check the below:

if ((vs.Major == 5) && (vs.Minor >= 1) || vs.Major >= 6 )

This way of checking gives you XP or higher condition ensuring compatibilty for future releases as well.

A major part of compatiblity is in the app developers hand, following good practices will make your app robust to OS changes!