Skip to content

Commit

Permalink
Show uninstall text even with /x /qf (#1881)
Browse files Browse the repository at this point in the history
* Show uninstall text even with /x /qf

Fixes #1858

* Resolve PR feedback

* Show full UI during uninstall
  • Loading branch information
heaths committed Aug 14, 2023
1 parent bab62cb commit 17d332f
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 16 deletions.
18 changes: 17 additions & 1 deletion cli/installer/windows/azd.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,30 @@
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\$(var.ProductFolder)" Name="InstallDir" Type="string" Value="[INSTALLDIR]"/>
<Environment Id="SystemPath" Action="set" Name="PATH" Part="last" System="yes" Value="[INSTALLDIR]"/>
</Component>

<!-- Override ARP to display full UI during uninstall. -->
<Component Directory="INSTALLDIR">
<RegistryKey Root="HKCU" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[ProductName]">
<RegistryValue Name="DisplayName" Value="[ProductName]" Type="string" />
<RegistryValue Name="DisplayVersion" Value="[ProductVersion]" Type="string" />
<RegistryValue Name="HelpLink" Value="https://aka.ms/azd/support" Type="string" />
<RegistryValue Name="InstallLocation" Value="[INSTALLDIR]" Type="string" />
<RegistryValue Name="NoModify" Value="1" Type="integer" />
<RegistryValue Name="Publisher" Value="[Manufacturer]" Type="string" />
<RegistryValue Name="UninstallString" Value="msiexec.exe /X[ProductCode] /qf" Type="string" />
</RegistryKey>
</Component>
</Feature>

<!-- Override ARP to display full UI during uninstall. -->
<Property Id="ARPSYSTEMCOMPONENT" Value="1" />

<!-- Broadcast environment variable changes even if a reboot is pending -->
<CustomActionRef Id="WixBroadcastEnvironmentChange" />

<!-- Use customized WixUI_InstallDir that changes the license agreement to just a notice -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>
<UIRef Id="AzureDevCLI_InstallDir"/>
<UIRef Id="AzdInstallDir"/>

<!-- Set the BinFolder property to use for cleaning up downloaded files -->
<SetProperty Id="BinFolder" Value="[%USERPROFILE]\.azd\bin" After="CostFinalize" Sequence="execute"/>
Expand Down
106 changes: 91 additions & 15 deletions cli/installer/windows/ui.wxs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="AzureDevCLI_InstallDir">
<UI Id="AzdInstallDir">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
Expand All @@ -16,29 +16,28 @@
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />

<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>

<Publish Dialog="ExitDlg" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="AzdExitDlg" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="NoticesDlg">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="AzdNoticesDlg">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

<Publish Dialog="NoticesDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="NoticesDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Dialog="AzdNoticesDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="AzdNoticesDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>

<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="NoticesDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="AzdNoticesDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
Expand All @@ -50,13 +49,27 @@
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>

<Property Id="ARPNOMODIFY" Value="1" />

<InstallUISequence>
<Show Dialog="WelcomeDlg" Before="AzdProgressDlg"><![CDATA[NOT Installed OR PATCH]]></Show>
<Show Dialog="MaintenanceWelcomeDlg" Before="AzdProgressDlg"><![CDATA[Installed AND NOT RESUME AND NOT Preselected AND NOT PATCH]]></Show>
<Show Dialog="ResumeDlg" Before="AzdProgressDlg"><![CDATA[Installed AND RESUME]]></Show>
<Show Dialog="VerifyReadyDlg" Before="AzdProgressDlg"><![CDATA[Installed AND NOT RESUME AND Preselected]]></Show>

<!-- Effectively remove WiX-standard ProgressDlg from the UI sequence since we otherwise can't without redefining the entirety of the UI. -->
<Show Dialog="ProgressDlg" Before="AzdProgressDlg"><![CDATA[0]]></Show>
</InstallUISequence>
</UI>

<UIRef Id="WixUI_Common" />

<SetProperty Id="WixUI_InstallMode" Value="Remove" After="CostFinalize" Sequence="ui">
<![CDATA[Installed AND &DefaultFeature<=2]]>
</SetProperty>
</Fragment>
<Fragment>
<UI>
<Dialog Id="NoticesDlg" Width="370" Height="270" Title="[ProductName] Setup">
<Dialog Id="AzdNoticesDlg" Width="370" Height="270" Title="[ProductName] Setup">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
Expand All @@ -78,29 +91,92 @@
</Fragment>
<Fragment>
<UI>
<Dialog Id="ExitDlg" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
<Dialog Id="AzdProgressDlg" Width="370" Height="270" Title="!(loc.ProgressDlg_Title)" Modeless="yes">
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.ProgressDlgBannerBitmap)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUINext)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<!-- Show "Installing" by default but hide if WixUI_InstallMode is set to anything. This resolves an odd behavior caused by dialog resequencing. -->
<Control Id="TextInstalling" Type="Text" X="20" Y="65" Width="330" Height="35" Hidden="no" NoPrefix="yes" Text="!(loc.ProgressDlgTextInstalling)">
<!-- <Condition Action="show"><![CDATA[NOT Installed OR (Installed AND (RESUME OR Preselected) AND NOT PATCH)]]></Condition> -->
<Condition Action="hide"><![CDATA[WixUI_InstallMode]]></Condition>
</Control>
<Control Id="TitleInstalling" Type="Text" X="20" Y="15" Width="330" Height="15" Transparent="yes" NoPrefix="yes" Hidden="no" Text="!(loc.ProgressDlgTitleInstalling)">
<!-- <Condition Action="show"><![CDATA[NOT Installed OR (Installed AND (RESUME OR Preselected) AND NOT PATCH)]]></Condition> -->
<Condition Action="hide"><![CDATA[WixUI_InstallMode]]></Condition>
</Control>
<Control Id="TextRepairing" Type="Text" X="20" Y="65" Width="330" Height="35" Hidden="yes" NoPrefix="yes" Text="!(loc.ProgressDlgTextRepairing)">
<Condition Action="show">WixUI_InstallMode = "Repair"</Condition>
</Control>
<Control Id="TitleRepairing" Type="Text" X="20" Y="15" Width="330" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.ProgressDlgTitleRepairing)">
<Condition Action="show">WixUI_InstallMode = "Repair"</Condition>
</Control>
<Control Id="TextRemoving" Type="Text" X="20" Y="65" Width="330" Height="35" Hidden="yes" NoPrefix="yes" Text="!(loc.ProgressDlgTextRemoving)">
<Condition Action="show">WixUI_InstallMode = "Remove"</Condition>
</Control>
<Control Id="TitleRemoving" Type="Text" X="20" Y="15" Width="330" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.ProgressDlgTitleRemoving)">
<Condition Action="show">WixUI_InstallMode = "Remove"</Condition>
</Control>
<Control Id="TextUpdating" Type="Text" X="20" Y="65" Width="330" Height="35" Hidden="yes" NoPrefix="yes" Text="!(loc.ProgressDlgTextUpdating)">
<Condition Action="show">WixUI_InstallMode = "Update"</Condition>
</Control>
<Control Id="TitleUpdating" Type="Text" X="20" Y="15" Width="330" Height="15" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="!(loc.ProgressDlgTitleUpdating)">
<Condition Action="show">WixUI_InstallMode = "Update"</Condition>
</Control>
<Control Id="ActionText" Type="Text" X="70" Y="100" Width="285" Height="10">
<Subscribe Event="ActionText" Attribute="Text" />
</Control>
<Control Id="ProgressBar" Type="ProgressBar" X="20" Y="115" Width="330" Height="10" ProgressBlocks="yes" Text="!(loc.ProgressDlgProgressBar)">
<Subscribe Event="SetProgress" Attribute="Progress" />
</Control>
<Control Id="StatusLabel" Type="Text" X="20" Y="100" Width="50" Height="10" Text="!(loc.ProgressDlgStatusLabel)" />
</Dialog>

<InstallUISequence>
<Show Dialog="AzdProgressDlg" Before="ExecuteAction" />
</InstallUISequence>
</UI>
</Fragment>
<Fragment>
<UI>
<Dialog Id="AzdExitDlg" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
<Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIFinish)" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUICancel)" />
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.ExitDialogBitmap)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)">
<Condition Action="hide"><![CDATA[WixUI_InstallMode]]></Condition>
</Control>
<Control Id="TitleRepaired" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="{\WixUI_Font_Bigger}[ProductName] repaired successfully">
<Condition Action="show"><![CDATA[WixUI_InstallMode = "Repair"]]></Condition>
</Control>
<Control Id="TitleRemoved" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="{\WixUI_Font_Bigger}[ProductName] removed successfully">
<Condition Action="show"><![CDATA[WixUI_InstallMode = "Remove"]]></Condition>
</Control>
<Control Id="TitleUpdated" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="{\WixUI_Font_Bigger}[ProductName] updated successfully">
<Condition Action="show"><![CDATA[WixUI_InstallMode = "Update"]]></Condition>
</Control>
<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" />
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" />
<Control Id="UninstallText" Type="Text" X="135" Y="110" Width="220" Height="120" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="The [ProductName] may have downloaded binaries to %USERPROFILE%\.azd\bin and, depending on how azd was used on this machine, may have downloaded binaries to other users' profile directories in their .azd\bin directory. These binaries may need to be removed manually.
To remove such binaries from your home directory, run:
rmdir %USERPROFILE%\.azd\bin.">
<Condition Action="show"><![CDATA[Installed AND REMOVE=ALL]]></Condition>
<Condition Action="show"><![CDATA[&DefaultFeature<=2]]></Condition>
</Control>
</Dialog>

<InstallUISequence>
<Show Dialog="ExitDlg" OnExit="success" Overridable="yes" />
<Show Dialog="AzdExitDlg" OnExit="success" />
</InstallUISequence>

<AdminUISequence>
<Show Dialog="ExitDlg" OnExit="success" Overridable="yes" />
<Show Dialog="AzdExitDlg" OnExit="success" />
</AdminUISequence>
</UI>
</Fragment>
Expand Down

0 comments on commit 17d332f

Please sign in to comment.