I'm making installation for my application with WiX toolset. I want to show custom dialog if previous version found.
Now I don't know how to check if there is previous version and show this dialog only in that case? Here is my code.
CustomDialogUI.wxs :
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="OldVersionDlg" Width="260" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="No" Type="PushButton" X="132" Y="57" Width="56" Height="17"
Default="yes" Cancel="yes" Text="No">
<Publish Event="EndDialog" Value="Exit">1</Publish>
</Control>
<Control Id="Yes" Type="PushButton" X="72" Y="57" Width="56" Height="17" Text="Yes">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Text" Type="Text" X="5" Y="15" Width="250" Height="30">
<Text>A previous version of [ProductName] is currently installed. By continuing the installation this version will be uninstalled. Do you want to continue?</Text>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="ValidateProductID" Value="0">1</Publish>
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
<Publish Event="NewDialog" Value="SetupTypeDlg">ProductID</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="50" Width="370" Height="0" />
</Dialog>
</UI>
With this I have created my dialog as I wanted and inserted into the original chain of dialogs.
And in my Project.wxs
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
<DialogRef Id="OldVersionDlg" />
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg" Order="3">LicenseAccepted = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="OldVersionDlg">1</Publish>
</UI>
With this I get my OldVErsionDlg everytime, and I don't know how to make him show ONLY if previous version exists.
I have added to Project.wxs
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="{80EE38CE-1A3B-445F-8CC1-31B32AA77715}">
<UpgradeVersion Minimum="1.0.0.0" Maximum="9.0.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
and tried with:
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
<DialogRef Id="OldVersionDlg" />
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg" Order="3">LicenseAccepted = "1" AND PREVIOUSVERSIONSINSTALLED</Publish>
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="OldVersionDlg">1</Publish>
</UI>
No luck with that.