Operating System Version Prerequisite

I have an application that requires at least Windows XP SP3. How can I test it both in the application and in MSI and automate the installation?

+3
source share
3 answers

In MSI, you create LaunchCondition using Operating System Properties

You want to check that VersionNT> 501 or (VersionNT = 501 and ServicePackLevel> 2)

(customization to meet your specific needs)

On Windows Installer XML, it looks like this:

<Product...>
  <Condition Message="[ProductName] Setup requires Windows XP SP3 or greater to install">VersionNT > 501 or ( VersionNT = 501 and ServicePackLevel > 2 ) or Installed</Condition>
...
</Product>
+4
source

, , , ...

OperatingSystem os = Environment.OSVersion;
Console.WriteLine("Platform:     " + os.Platform);
Console.WriteLine("Version:      " + os.Version);
Console.WriteLine("Service Pack: " + os.ServicePack);
0
Version winXpSp3 = new Version("5.1.2600.5512"); // to be checked, I don't have XP SP3 available...
if (Environment.OSVersion.Version < winXpSp3)
{
    MessageBox.Show("You need Windows XP SP3 or later");
    ...
}

You can use this code at the user installation stage (apparently not, according to Christopher Painter ... I leave the code anyway, it can still help someone in a different context)

-1
source

Source: https://habr.com/ru/post/1767260/


All Articles