add uninstaller to wix

This commit is contained in:
tensor-programming
2019-12-23 19:55:51 -05:00
parent e8fea2e9f3
commit 7f52db1b97
2 changed files with 35 additions and 4 deletions

View File

@@ -29,7 +29,7 @@
<Media Id="1" Cabinet="app.cab" EmbedCab="yes" />
<Icon Id="ProductIcon" SourceFile="{{{icon_path}}}"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
<Property Id="ARPNOREPAIR" Value="1"/>
<Property Id="ARPNOMODIFY" Value="1"/>
@@ -43,16 +43,45 @@
</Directory>
</Directory>
<DirectoryRef Id="APPLICATIONFOLDER">
<Component Id="CMP_ReadFileShortcut"
Guid="1AF06B42-CD42-4AED-959F-36DB5E512046">
<Shortcut Id="UninstallShortcut"
Name="Uninstall {{{product_name}}}"
Description="Uninstalls {{{product_name}}}"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]" />
<RemoveFolder Id="RemoveDIR_Shortcuts"
On="uninstall" />
<RegistryValue Root="HKCU"
Key="Software\{{{manufacturer}}}\{{{product_name}}}"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>
<Feature
Id="MainProgram"
Title="Application"
Description="Installs the executable."
Description="Installs {{{product_name}}}."
Level="1"
ConfigurableDirectory="APPLICATIONFOLDER"
AllowAdvertise="no"
Display="expand"
Absent="disallow">
<Feature Id="ShortcutsFeature"
Title="Shortcuts"
Level="1">
<ComponentRef Id="CMP_ReadFileShortcut" />
</Feature>
<Feature
Id="Environment"
Title="PATH Environment Variable"
@@ -64,6 +93,5 @@
</Feature>
<SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize"/>
</Product>
</Wix>

View File

@@ -355,6 +355,9 @@ pub fn build_wix_app_installer(
let path_guid = generate_package_guid(settings).to_string();
data.insert("path_component_guid", &path_guid.as_str());
let shortcut_guid = generate_package_guid(settings).to_string();
data.insert("shortcut_guid", &shortcut_guid.as_str());
let app_exe_name = settings.binary_name().to_string();
data.insert("app_exe_name", &app_exe_name);
@@ -363,7 +366,7 @@ pub fn build_wix_app_installer(
data.insert("app_exe_source", &app_exe_source);
let image_path = copy_icons(&settings)?;
let image_path = image_path.display().to_string();
let image_path = image_path.join("icon.ico").display().to_string();
// copy icons from icons folder to resource folder near msi
data.insert("icon_path", &image_path);