Skip to content

Commit

Permalink
(chocolatey#3286) Prevent MSI Upgrades
Browse files Browse the repository at this point in the history
Currently it's not possible to upgrade Chocolatey with the MSI. This
commit adds functionality to the MSI that will error instead of blindly
allowing an upgrade that doesn't do anything.
  • Loading branch information
corbob committed Aug 1, 2023
1 parent 34abed0 commit e05e807
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/chocolatey.install/chocolatey.en-us.wxl
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<String Id="ProfileAdditionDescription" Overridable="yes">Add the Chocolatey Helpers to your PowerShell Profile to enable tab-completions.
Defaults to adding to the AllUsersAllHosts profile.</String>
<String Id="RequiresDotNet48" Overridable="yes">This application requires .NET Framework 4.8. Please install the .NET Framework then run this installer again.</String>
<String Id="UpgradeNotAllowed" Overridable="yes">UPGRADE FAILURE: Chocolatey CLI cannot be upgraded via the MSI. Please run 'choco upgrade chocolatey' from an elevated terminal window.</String>
<String Id="ToolsFolderDescription" Overridable="yes">Sets the location for the Tools Folder</String>
</WixLocalization>
</WixLocalization>
2 changes: 1 addition & 1 deletion src/chocolatey.install/chocolatey.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<Product Name="$(var.ProductName)" Id="*" UpgradeCode="$(var.ProductCode)" Language="1033" Manufacturer="$(var.ProductVendor)" Codepage="1252" Version="$(var.ProductVersion)">
<Package Id='*' Platform='x86' Keywords='Installer' Description="$(var.ProductName)" Comments="$(var.ProductSummary)" InstallScope="perMachine" InstallerVersion="200" Compressed="yes" />
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="!(loc.NewerVersionInstalled)" />
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="!(loc.NewerVersionInstalled)" Disallow="yes" DisallowUpgradeErrorMessage="!(loc.UpgradeNotAllowed)" />
<Media Id="1" Cabinet="$(var.ArtifactName).cab" EmbedCab="yes" />

<!-- Installation Properties -->
Expand Down

0 comments on commit e05e807

Please sign in to comment.