Skip to content

Commit

Permalink
Allow dev builds to upgrade all versions
Browse files Browse the repository at this point in the history
Resolves Azure#2815
  • Loading branch information
heaths committed Oct 3, 2023
1 parent d28bd96 commit 4acebf8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
5 changes: 4 additions & 1 deletion cli/installer/windows/azd.wixproj
Expand Up @@ -5,7 +5,8 @@
<SchemaVersion>2.0</SchemaVersion>
<Configuration Condition="'$(Configuration)'==''">Release</Configuration>
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<ProductVersion Condition="'$(CLI_VERSION)' != ''">$(CLI_VERSION)</ProductVersion>
<ProductName Condition="'$(ProductName)' == ''">Azure Developer CLI (dev)</ProductName>
<ReleaseBuild Condition="'$(ProductVersion)' != ''">true</ReleaseBuild>
<ProductVersion Condition="'$(ProductVersion)' == ''">0.1.0</ProductVersion>
<!-- Windows Installer ProductVersion uses only major.minor.patch -->
<ProductVersion Condition="$(ProductVersion.IndexOf('-')) &gt; 0">$(ProductVersion.Substring(0, $(ProductVersion.IndexOf('-'))))</ProductVersion>
Expand All @@ -18,7 +19,9 @@
<IntermediateOutputPath>obj\$(Configuration)</IntermediateOutputPath>
<DefineConstants>
$(DefineConstants);
ProductName=$(ProductName);
ProductVersion=$(ProductVersion);
ReleaseBuild=$(ReleaseBuild);
</DefineConstants>
<SuppressIces Condition="'$(Platform)' == 'arm' Or '$(Platform)' == 'arm64'">ICE39</SuppressIces>
<DefineSolutionProperties>false</DefineSolutionProperties>
Expand Down
21 changes: 16 additions & 5 deletions cli/installer/windows/azd.wxs
@@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>

<?define ProductName = "Azure Developer CLI"?>
<?define ProductFolder = "Azure Dev CLI"?>
<?ifndef ProductName?>
<?error ProductName property not defined?>
<?endif?>

<?ifndef ProductVersion?>
<?error ProductVersion property not defined?>
<?endif?>

<!-- BaseProductName is used for shared registration; should be per-channel (or just use ProductName) if/when channels are supported. -->
<?define BaseProductName = "Azure Developer CLI"?>
<?define ProductFolder = "Azure Dev CLI"?>

<!-- Define a unique UpgradeCode per platform -->
<?if $(var.Platform) = "x64"?>
<?define UpgradeCode = "37533D38-361D-4CDB-939C-B05A9A17B2DA"?>
Expand All @@ -32,7 +37,13 @@
<Property Id="REINSTALLMODE" Value="amus"/>

<!-- Remove older product(s) late but within the transaction to support removing ~\.azd\bin -->
<MajorUpgrade Schedule="afterInstallExecute" DowngradeErrorMessage="A newer version of !(bind.property.ProductName) is already installed."/>
<?if $(var.ReleaseBuild) = "true"?>
<!-- Release builds should still be linear to prevent installing older version. -->
<MajorUpgrade Schedule="afterInstallExecute" DowngradeErrorMessage="A newer version of $(var.BaseProductName) is already installed."/>
<?else?>
<!-- Dev builds should install over any other version installed for easy testing. -->
<MajorUpgrade Schedule="afterInstallExecute" AllowDowngrades="yes"/>
<?endif?>

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.ProgramFilesFolder)" Name="Program Files">
Expand Down Expand Up @@ -80,8 +91,8 @@

<!-- 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" />
<RegistryKey Root="HKCU" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(var.BaseProductName)">
<RegistryValue Name="DisplayName" Value="$(var.BaseProductName)" 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" />
Expand Down

0 comments on commit 4acebf8

Please sign in to comment.