Custom actions before LaunchConditions
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 2开发者_如何学运维003(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>
Assuming you're using the WiX NetFx NETFRAMEWORK35 property, you need to schedule FrameworkMissing after AppSearch, which is the standard action that processes RegistrySearch.
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
精彩评论