Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Wix安装程序中检查系统是否为Windows 7或Windows Server 2008 R2?_Wix_Windows Installer_System_Conditional Statements - Fatal编程技术网

如何在Wix安装程序中检查系统是否为Windows 7或Windows Server 2008 R2?

如何在Wix安装程序中检查系统是否为Windows 7或Windows Server 2008 R2?,wix,windows-installer,system,conditional-statements,Wix,Windows Installer,System,Conditional Statements,我正在从事windows installer项目。现在我只希望该软件只能安装在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> (Versio

我正在从事windows installer项目。现在我只希望该软件只能安装在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>
(VersionNT=600和ServicePackLevel=1)或VersionNT=601
但它仍然可以安装在WindowsVista上。请帮忙


谢谢大家!

Vista和Server 2008 pre-SP2具有相同的主版本号。您还需要寻找与“版本服务器”(InstallShield)等效的Wix。(现在工作时,这里没有安装Wix)

请参阅和示例

<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>
Version9X=400
版本9x=400和WindowsBuild=1111
版本9X=410
版本9X=410和WindowsBuild=2222
版本9X=490
版本NT=400
VersionNT=400和ServicePackLevel=n
版本NT=500
VersionNT=500,ServicePackLevel=n
版本NT=501
VersionNT=501,ServicePackLevel=n
VersionNT=501,MsiNTSuitePersonal和ServicePackLevel=n
版本NT=502
版本NT=600
VersionNT=600,ServicePackLevel=1
VersionNT=600和MsiNTProductType=3
版本NT=601
版本NT=602

只需检查NT 601或更高版本、Windows 7和Server 2008 R2

=601]>

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

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

1) 或已安装]]>

这里有关于windows版本的microsoft页面:附加说明:原始海报询问如何使用运算符“=”检查某个特定的操作系统版本。这是一个永远不应该犯的大错!相反,我们需要使用运算符“>=”。这已经包含在saschabeaumont当前的回答中。我只想指出,最初问题中概述的要求是无效的。我们需要避免这样的错误。遗憾的是,这个链接似乎死了……我们尝试过修复它
<Condition Message="Windows Server 2008R2 required">
  <![CDATA[(VersionNT = 601 AND MsiNTProductType > 1) OR Installed]]>
</Condition>