LaunchConditions 之前的自定义操作

发布于 2024-11-14 17:31:43 字数 2479 浏览 2 评论 0原文

我需要检查框架版本、操作系统版本和启动条件之前的管理员权限。我的操作系统版本和管理条件按预期工作,但框架版本不工作。 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>

i need to check Framework version, OS version & Admin privileges before LaunchConditions. My OS Version & Admin conditions works as expected, but not framework version. NETFRAMEWORK35 is not getting populated. Below is my code.

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月野兔 2024-11-21 17:31:43

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

Assuming you're using the WiX NetFx NETFRAMEWORK35 property, you need to schedule FrameworkMissing after AppSearch, which is the standard action that processes RegistrySearch.

只是偏爱你 2024-11-21 17:31:43

使用product.wxs 中的此代码来检查是否需要框架。

<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。同样,您可以更改条件来检查其他版本

Use this code in product.wxs to check for require frameworks.

<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>

Here i am checking for .net framework 2.0. Similarly you can change the condition to check for other versions

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文