1

我正在尝试确定系统是否为 windows server 2008 r2。Windows 7 带有相同的 VersionNT 编号,因此我尝试使用 MSINTProductType 但此消息仍在 Windows 7 系统上抛出。

我目前的 WIX 代码是:

<Condition Message="For windows 2008 R2 system application server role service is required>
    VersionNT = 601 AND MsiNTProductType = 3 Not AppServer
<Condition/>

<Property Id="APPSERVER">
    <RegistrySearch Id="AppServerInstalled"
                    Root="HKLM"
                    Key="SOFTWARE\Microsoft\Windows\CurrentVersion"
                    Type="Raw"/>
 </Property>
4

3 回答 3

1

http://wix.tramontana.co.hu/tutorial/getting-started/useful-extras

<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>
于 2013-04-26T11:09:18.733 回答
0

就我个人而言,我不会为 Worksation 与 Server 编写检查,因为在 Windows 世界中它们本质上是相同的。例如,我在这里有一台运行 Windows 8 和 SQL Server 2012 和 TFS Server 2012 的平板电脑。Win 8 拥有所需的一切,如果安装程序告诉我“你没有运行服务器 o/s”,那会很烦人'。

如果您对仅在服务器中的某些内容有依赖关系,请为此编写依赖关系检查。

于 2013-04-26T13:22:11.453 回答
-1

经过多次测试,我设法得到了答案

如果您在 Windows 2008 r2 服务器上工作,要抛出一条消息,您可以使用以下条件语句。

  <Condition Message="Windows Server 2008R2 installed">
        <NOT (VersionNT = 601 AND MsiNTProductType > 1 )]]>
  </Condition>

我已经编写了一个自定义操作来确定是否安装了应用程序服务器。

<CustomAction()>
Public Shared Function CheckForAppServer(ByVal pobjSession As Session) As ActionResult
    pobjSession.Log("Beginning Check for Application Server")
    Dim lobjRegKey As RegistryKey
    If Environment.Is64BitOperatingSystem Then
        pobjSession.Log("64bit Opperating system detected")
        lobjRegKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)
    Else
        pobjSession.Log("32bit Opperating system detected")
        lobjRegKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)
    End If
    Dim lobjApplicationServerRegKey As Object = lobjRegKey.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\AppServer", True)
    If lobjApplicationServerRegKey Is Nothing Then
        pobjSession.Log("Application Server registry key not found")
        pobjSession("APPSERVER") = "0"
    Else
        pobjSession.Log(lobjApplicationServerRegKey.ToString)
        pobjSession.Log("Application Server registry key found")
        pobjSession("APPSERVER") = "1"
    End If
    Return ActionResult.Success
End Function

加载我的自定义操作并更新 InstallUISequence 和 Install Execute Sequence 以确保在抛出条件消息之前设置属性。

  <InstallUISequence>
        <Custom Action="CA_CheckForAppServer" Before="LaunchConditions" >NOT Installed</Custom>
      </InstallUISequence>
 <InstallExecuteSequence>
 <Custom Action="CA_CheckForAppServer" Before="LaunchConditions" >NOT Installed</Custom>
 </InstallExecuteSequence>

将我的条件消息更新为以下内容

   <Condition Message="Windows Server 2008R2 requires the application server to be enabled">
        <![CDATA[APPSERVER <> 0 OR NOT (VersionNT = 601 AND MsiNTProductType > 1 )]]>
      </Condition>
于 2013-04-30T10:06:35.360 回答