The easiest way to check the version of Windows on which your .NET application is running, is to use the following line:
Environment.OSVersion.ToString();
The above line should return something similar to “Microsoft Windows NT 5.1.2600 Service Pack 2” on a system running Windows XP SP2. However, if it does not, an alternative and more precise way is explained at http://support.microsoft.com/default.aspx?scid=kb;EN-US;304721.