如何在Wix Installer中检查系统是Windows 7还是Windows Server 2008 R2?

Ray*_*Ray 11 windows-installer wix system conditional-statements

我正在开发一个Windows安装程序项目.现在我只希望软件只能安装在Windows 7或Windows Server 2008 R2系统上,我试着用这个:

<Condition Message='Windows Server 2008 R2 or Windows 7 is required'>(VersionNT = 600 AND ServicePackLevel = 1) OR VersionNT = 601 </Condition>
Run Code Online (Sandbox Code Playgroud)

但它仍然可以安装在Windows Vista上.请帮忙!

谢谢!

Pre*_*gha 24

有关示例,请参阅https://www.msigeek.com/442/windows-os-version-numbershttps://www.lifewire.com/windows-version-numbers-2625171

<Condition Message='Windows 95'>Version9X = 400</Condition>
<Condition Message='Windows 95 OSR2.5'>Version9X = 400 AND WindowsBuild = 1111</Condition>
<Condition Message='Windows 98'>Version9X = 410</Condition>
<Condition Message='Windows 98 SE'>Version9X = 410 AND WindowsBuild = 2222</Condition>
<Condition Message='Windows ME'>Version9X = 490</Condition>
<Condition Message='Windows NT4'>VersionNT = 400</Condition>
<Condition Message='Windows NT4 SPn'>VersionNT = 400 AND ServicePackLevel = n</Condition>
<Condition Message='Windows 2000'>VersionNT = 500</Condition>
<Condition Message='Windows 2000 SPn'>VersionNT = 500 AND ServicePackLevel = n</Condition>
<Condition Message='Windows XP'>VersionNT = 501</Condition>
<Condition Message='Windows XP SPn'>VersionNT = 501 AND ServicePackLevel = n</Condition>
<Condition Message='Windows XP Home SPn'>VersionNT = 501 AND MsiNTSuitePersonal AND ServicePackLevel = n</Condition>
<Condition Message='Windows Server 2003'>VersionNT = 502</Condition>
<Condition Message='Windows Vista'>VersionNT = 600</Condition>
<Condition Message='Windows Vista SP1'>VersionNT = 600 AND ServicePackLevel = 1</Condition>
<Condition Message='Windows Server 2008'>VersionNT = 600 AND MsiNTProductType = 3</Condition>
<Condition Message='Windows 7'>VersionNT = 601</Condition>
<Condition Message='Windows 8'>VersionNT = 602</Condition>
Run Code Online (Sandbox Code Playgroud)


sas*_*ont 10

只需检查VersionNT 601或更新版本,Windows 7和Server 2008 R2 都具有相同的值.

<Condition Message="Win7 or 2008 R2 required"><![CDATA[Installed OR VersionNT >= 601]]></Condition>
Run Code Online (Sandbox Code Playgroud)


小智 6

您可以使用该MsiNTProductType属性来检测它是否是服务器操作系统.结合NT版本检查,您可以检查是否有Windows Server 2008R2.这将如下所示:

<Condition Message="Windows Server 2008R2 required">
  <![CDATA[(VersionNT = 601 AND MsiNTProductType > 1) OR Installed]]>
</Condition>
Run Code Online (Sandbox Code Playgroud)