LaunchConditions之前的自定义操作

时间:2011-06-10 09:29:13

标签: wix wix3

我需要检查Framework版本,操作系统版本和版本; LaunchConditions之前的管理员权限。我的操作系统版本&管理条件按预期工作,但不是框架版本。 NETFRAMEWORK35没有填充。以下是我的代码。

<PropertyRef Id="NETFRAMEWORK35" />
<UI>
  <UIRef Id='...'/>
  <Error Id="2001">Please uninstall older version of this product to continue.</Error>
  <Error Id="2002">This application is only supported on Windows Server 2008(64 bit) or Windows 2003(32 or 64 bit).</Error>
  <Error Id="2003">Microsoft .NET Framework Version 3.5 is missing. To download please visit $(var.FrameworkDownload)</Error>
  <Error Id="2004">You need to be an administrator to install this product.</Error>

</UI>

<CustomAction Id="CurrentVersionDetected" Error="2001"/>
<CustomAction Id="WrongOSVersionDetected" Error="2002" />
<CustomAction Id="FrameworkMissing" Property="NETFRAMEWORK35" Error="2003" />
<CustomAction Id="IsNotAdministrator" Error="2004" />

<InstallExecuteSequence>
  <Custom Action="IsNotAdministrator" After="FrameworkMissing">
    <![CDATA[NOT(Installed OR Privileged)]]>
  </Custom>
  <Custom Action="FrameworkMissing" After="WrongOSVersionDetected">
    **<![CDATA[NETFRAMEWORK35]]> //This is make sure it is getting fired, but not**
  </Custom>
  <Custom Action="WrongOSVersionDetected" After="FindRelatedProducts">
    <![CDATA[NOT(Installed OR VersionNT = 601 OR (VersionNT = 600 AND VersionNT64))]]>
  </Custom>
  <Custom Action="CurrentVersionDetected" After="AppSearch">SELFFOUND</Custom>
</InstallExecuteSequence>

<InstallUISequence>
  <Custom Action="IsNotAdministrator" After="FrameworkMissing">
    <![CDATA[NOT(Installed OR Privileged)]]>
  </Custom>
  <Custom Action="FrameworkMissing" After="WrongOSVersionDetected">
    **<![CDATA[NETFRAMEWORK35]]> //This is make sure it is getting fired, but not**
  </Custom>
  <Custom Action="WrongOSVersionDetected" After="FindRelatedProducts">
    <![CDATA[NOT(Installed OR VersionNT = 601 OR (VersionNT = 600 AND VersionNT64))]]>
  </Custom>
  <Custom Action="CurrentVersionDetected" After="AppSearch">SELFFOUND</Custom>
</InstallUISequence>


 But strangely same action work if i put it after InstallValidate

 <Custom Action="FrameworkMissing" After="InstallValidate">
    **<![CDATA[NETFRAMEWORK35]]> //This is fired**
 </Custom>

2 个答案:

答案 0 :(得分:0)

假设您使用的是WiX NetFx NETFRAMEWORK35属性,则需要在AppSearch之后安排FrameworkMissing,这是处理RegistrySearch的标准操作。

答案 1 :(得分:0)

在product.wxs中使用此代码来检查require框架。

<Condition Message=  
         'This setup requires the .NET Framework 2.0 or higher. Please install .NET Framework 2.0 or higher and run the setup again.'>
      <![CDATA[MsiNetAssemblySupport >= "2.0.50727"]]>
    </Condition>

我在这里检查.net framework 2.0。同样,您可以更改条件以检查其他版本