代码之家  ›  专栏  ›  技术社区  ›  Jeremy

操作系统版本先决条件

  •  3
  • Jeremy  · 技术社区  · 14 年前

    3 回复  |  直到 14 年前
        1
  •  4
  •   Christopher Painter    14 年前

    在MSI中,您编写了一个 LaunchCondition 使用 Operating System Properties

    (调整以满足您的确切需求)

    <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>
    
        2
  •  0
  •   Josh Stodola    14 年前

    我不知道如何在安装之前做到这一点,但我知道,在应用程序代码本身,你可以做到这一点。。。

    OperatingSystem os = Environment.OSVersion;
    Console.WriteLine("Platform:     " + os.Platform);
    Console.WriteLine("Version:      " + os.Version);
    Console.WriteLine("Service Pack: " + os.ServicePack);
    
        3
  •  -1
  •   Thomas Levesque    14 年前
    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");
        ...
    }
    

    (据克里斯托弗·佩特(Christopher Painter)所说,显然不是这样……不管怎样,我留下了代码,它仍然可以在另一个上下文中帮助某人)