Skip to content

Commit

Permalink
update version in Uninstall reg key
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdisaster committed May 6, 2020
1 parent efa557b commit f58e903
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 14 deletions.
10 changes: 8 additions & 2 deletions src/utils/version-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ export function getWindowsCompliantVersion(input: string): string {
}
}

export function createMsiVersionInfoFile(version: string): string {
export function createInstallInfoFile(productCode: string,
installVersion: string,
arch: string): string {
const { tempFilePath } = getTempFilePath('.installInfo', 'json');
fs.writeJSONSync(tempFilePath, { baseVersion: version });
fs.writeJSONSync(tempFilePath, {
productCode,
arch,
installVersion,
});
return tempFilePath;
}
1 change: 1 addition & 0 deletions static/permission.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<util:PermissionEx User="[UPDATERUSERGROUP]" GenericAll="{{GenericAll}}" ChangePermission='yes' />
4 changes: 3 additions & 1 deletion static/registry-component.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- {{I}} --><Component Id="{{ComponentId}}" Guid="{{Guid}}" Win64="{{Win64YesNo}}">
<!-- {{I}} --> <RegistryValue Root="{{Root}}" Key="{{Key}}" Name="{{Name}}" Type="{{Type}}" Value="{{Value}}" KeyPath="yes" />
<!-- {{I}} --> <RegistryValue Root="{{Root}}" Key="{{Key}}" Name="{{Name}}" Type="{{Type}}" Value="{{Value}}" KeyPath="yes">
<!-- {{I}} --> <!-- {{Permission}} -->
<!-- {{I}} --> </RegistryValue>
<!-- {{I}} --></Component>
40 changes: 29 additions & 11 deletions static/wix.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!-- http://wixtoolset.org/documentation/manual/v3/xsd/wix/product.html -->
<Product Id="*" UpgradeCode="{{UpgradeCode}}"
Name="{{ApplicationName}}"
Version="{{Version}}"
Manufacturer="{{Manufacturer}}"
Language="{{Language}}">
<Product Id="{{ProductCode}}"
UpgradeCode="{{UpgradeCode}}"
Name = "{{ApplicationName}} (Machine - MSI)"
Version="{{Version}}"
Manufacturer="{{Manufacturer}}"
Language="{{Language}}">
<!-- Only run this installer on Windows 7 or up (or if it"s already installed, I guess) -->
<!-- <Condition Message="This application is only supported on Windows 7 or higher.">
<![CDATA[Installed OR (VersionNT >= 601)]]>
Expand All @@ -15,6 +16,13 @@
Compressed="yes"
Comments="Windows Installer Package"
Platform="{{Platform}}"/>
<!-- This will hide our Uninstall entry in Apps & Features. We doing this so
we can write our own which we can better control. -->
<Property Id="ARPSYSTEMCOMPONENT" Value="1" />
<!-- While the MSI package is hidden in Apps & Features, it can still be queried
via PowerShell and other means. To differentiate we give the public entry a slightly
different name to make admins life easier. -->
<Property Id="VisibleProductName" Value="{{ApplicationName}} (Machine)" />
<!-- Signals Single Package Authoring. This pacakge can pe installed perMachine
or perUser. The mode is determined by the property below. -->
<Property Id="ALLUSERS" Secure="yes" Value="2" />
Expand All @@ -41,27 +49,37 @@
PurgeOnUninstall action. Since this package can be installed perUser or perMachine,
we have to look in both places. First successful search wins. -->
<Property Id="INSTALLPATH">
<RegistrySearch Key="SOFTWARE\{{Manufacturer}}\{{ApplicationName}}"
<RegistrySearch Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{{{ProductCode}}}.msiSquirrel"
Root="HKCU"
Type="raw"
Id="INSTALLPATH_REGSEARCH_HKCU"
Name="InstallPath"
Win64="{{Win64YesNo}}"/>
<RegistrySearch Key="SOFTWARE\{{Manufacturer}}\{{ApplicationName}}"
<RegistrySearch Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{{{ProductCode}}}.msiSquirrel"
Root="HKLM"
Type="raw"
Id="INSTALLPATH_REGSEARCH_HKLM"
Name="InstallPath"
Win64="{{Win64YesNo}}"/>
</Property>

<!-- Lets change the product name depending on the perUser installMode.
This way the user and admins can see in which scope the MSI was installed. -->
<SetProperty Action="SetVisibleProductName" Id="VisibleProductName" Sequence="both" Before="AppSearch" Value="{{ApplicationName}} (User)">
<![CDATA[MSIINSTALLPERUSER = "1"]]>
</SetProperty>
<!-- Again we give thee MSI generaten entry a slightly different name to help
differentiate between the public one and the invisible one. -->
<SetProperty Action="SetProductName" Id="ProductName" Sequence="both" Before="AppSearch" Value="{{ApplicationName}} (User - MSI)">
<![CDATA[MSIINSTALLPERUSER = "1"]]>
</SetProperty>

<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>

<!-- Handle Updates -->
<Upgrade Id="{{UpgradeCode}}">
<UpgradeVersion OnlyDetect="no" Property="PREVIOUSFOUND"
Minimum="0.0.0" IncludeMinimum="yes"
Maximum="{{Version}}" IncludeMaximum="yes" />
Maximum="{{Version}}" IncludeMaximum="yes" />
</Upgrade>

<InstallExecuteSequence>
Expand Down Expand Up @@ -128,13 +146,13 @@
<!-- Lets cleanup any files that are were not part of the initial install
via this MSI. Such as newer versions installed by the auto-updater. -->
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="PurgeOnUninstall" Guid="9c034d1f-e0e7-42f8-92b0-40e7d895217c" Win64="{{Win64YesNo}}">
<Component Id="PurgeOnUninstall" Guid="{{RandomGuid}}" Win64="{{Win64YesNo}}">
<CreateFolder/>
<util:RemoveFolderEx On="uninstall" Property="INSTALLPATH" />
</Component>
</DirectoryRef>

<Feature Id="Complete" Title="{{ApplicationName}} ({{Version}})" Description="The complete package." Display="expand" Level="1" {{ConfigurableDirectory}}>
<Feature Id="Complete" Title="{{ApplicationName}} ({{SemanticVersion}})" Description="The complete package." Display="expand" Level="1" {{ConfigurableDirectory}}>
<!-- Step 5: Tell WiX to install the files -->
<Feature Id="MainApplication" Title="Main Application" Level="1" Description="The main components to run the applications." >
<!-- {{ComponentRefs}} -->
Expand Down

0 comments on commit f58e903

Please sign in to comment.