我刚开始使用WiX,我用一些文件、一些注册表项和一个文件关联创建了一个简单的perUser应用程序安装。我用UID将所有东西放入组件中。安装过程运行良好。
我读了很多关于如何定义什么和如何卸载这些组件的文章,但是无论在哪里,卸载过程都会找到每个组件(文件、注册表项等)并自动删除它们。相反-在“成功”卸载后,我可以找到每个文件,每个注册表项未动。我想要删除一切(文件,注册表项,文件关联)。
我做错了什么?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- DO NOT MODIFY THESE SETTINGS -->
<?define Manufacturer="MyCompany" ?>
<?define UpgradeCode="C9998877-7796-4E81-B45B-E7068A15E229" ?>
<?define VersionNumber="3.3.2"?>
<?define ProductName="MyCompany Release dosomething" ?>
<?define ApplicationName="MyCompany Release dosomething App" ?>
<?define Description="MyCompany Release dosomething Tool" ?>
<!-- MODIFY THESE SETTINGS AT EVERY NEW VERSION -->
<?define dosomething_exe_src = "FILES\MyCompanyDoSomething.exe" ?>
<?define dosomething_ini_src = "FILES\MyCompanyDoSomething.exe.config" ?>
<?define dosomething_eula_src = "FILES\eula.rtf" ?>
<Product Id="*"
Name="$(var.ProductName)"
Language="1033"
Version="$(var.VersionNumber)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Package Id="*"
InstallerVersion="200"
Compressed="yes"
InstallScope="perUser"
Manufacturer="$(var.Manufacturer)"
Description="$(var.Description)"
InstallPrivileges="limited" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Property Id="ALLUSERS" Secure="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.VersionNumber)" IncludeMinimum="no"
OnlyDetect="yes"
Property="NEWERVERSIONS" />
<UpgradeVersion Minimum="0.0.0" IncludeMinimum="yes"
Maximum="$(var.VersionNumber)" IncludeMaximum="no"
OnlyDetect="no"
IgnoreRemoveFailure="yes"
Property="OLDERVERSIONS" />
</Upgrade>
<Condition Message="A newer version of [ProductName] is already installed. Exiting installation.">
<![CDATA[Installed OR NOT NEWERVERSIONS]]>
</Condition>
<Condition Message="!(loc.LaunchCondition_AllUsers)">
NOT ALLUSERS
</Condition>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- :: Installation Variables :: -->
<Property Id="WixAppFolder" Value="WixPerUserFolder" />
<Property Id="ApplicationFolderName" Value="Install path" />
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER"/>
<WixVariable Id="WixUILicenseRtf" Value="FILES\eula.rtf" />
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- :: Main Installation Directory Structure :: -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="LocalAppDataFolder">
<!-- perUser case, it is redirected automatically to LocalAppDataFolder -->
<Directory Id="ProgramFilesHK" Name="$(var.Manufacturer)">
<Directory Id="APPLICATIONFOLDER" Name="$(var.ApplicationName)">
<Component Id="CMP_dosomething_exe" Guid="0BA6F4AB-9ED4-4CF2-BDFF-0C95F1DF4BA0" Permanent="no">
<CreateFolder />
<RemoveFolder Id="RemoveFolder_ProgramFilesHK" Directory="ProgramFilesHK" On="uninstall" />
<RemoveFolder Id="RemoveFolder_ApplicationFolder" Directory="APPLICATIONFOLDER" On="uninstall" />
<File Source="$(var.dosomething_exe_src)" Id="dosomething_exe_file" Vital="yes" />
<ProgId Id="$(var.ApplicationName).Document" Description="$(var.Description)" Advertise="no">
<Extension Id="MyCompanyDoSomething" ContentType="application/MyCompanyDoSomething">
<Verb Id="Open" Command="Open" Argument=""%1"" TargetFile="dosomething_exe_file"/>
<MIME Advertise="no" ContentType="application/MyCompanyDoSomething" Default="yes" />
</Extension>
</ProgId>
<RegistryKey Root="HKCU" Key="Software\MyCompany\MyApplication" ForceDeleteOnUninstall="yes">
<RegistryValue Name="Version" Value="[ProductVersion]" Type="string" KeyPath="yes"/>
</RegistryKey>
</Component>
<Component Id="CMP_dosomething_ini" Guid="6F0201F1-A1C1-4378-9ED7-5D47AB750AD1">
<File Source="$(var.dosomething_ini_src)" Id="dosomething_ini_file" Vital="yes"/>
<RegistryKey Root="HKCU" Key="Software\MyCompany\MyApplication" ForceDeleteOnUninstall="yes">
<RegistryValue Name="Version" Value="[ProductVersion]" Type="string" KeyPath="yes"/>
</RegistryKey>
</Component>
<Component Id="CMP_eula_doc" Guid="{9D320C1F-E16A-46D3-AF2F-5AE496B8C365}">
<File Source="$(var.dosomething_eula_src)" Id="dosomething_eula_file" Vital="yes"/>
<RegistryKey Root="HKCU" Key="Software\MyCompany\MyApplication" ForceDeleteOnUninstall="yes">
<RegistryValue Name="Version" Value="[ProductVersion]" Type="string" KeyPath="yes"/>
</RegistryKey>
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder">
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="AppShortcutsDir" Name="$(var.ApplicationName)" />
</Directory>
</Directory>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- :: Desktop -> Shortcut to start the application :: -->
<DirectoryRef Id="DesktopFolder">
<Component Id="CMP_DesktopShortcut" Guid="{E6024E33-E5B8-4136-9402-22BA0614013D}">
<Shortcut Id="DAppStarterShortcut" Name="$(var.ApplicationName)" Description="$(var.Description)" Target="[APPLICATIONFOLDER]MyCompanyDoSomething.exe" />
<RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- :: Start Menu -> Shortcuts to start the application, eula, uninstall, etc. :: -->
<DirectoryRef Id="AppShortcutsDir">
<Component Id="CMP_StartMenuShortcut" Guid="{439DAE58-5DE5-4A45-952E-05956D5B4A49}">
<Shortcut Id="SAppStarterShortcut" Name="$(var.ApplicationName)" Description="$(var.Description)" Target="[APPLICATIONFOLDER]MyCompanyDoSomething.exe" />
<Shortcut Id="SEulaReadShortcut" Name="$(var.ApplicationName) EULA" Description="End User Agreement" Target="[APPLICATIONFOLDER]eula.rtf" />
<Shortcut Id="SUninstallShortcut" Name="Uninstall $(var.ApplicationName)" Description="Uninstall $(var.ApplicationName) and all of its components" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" />
<RemoveFolder Id="RemoveMyShortcutsDir" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- :: Installation Feature Tree :: -->
<Feature Id="MyCompanyDosomethingTool" Title="MyCompany Dsomething Tool" Level="1" ConfigurableDirectory="APPLICATIONFOLDER">
<ComponentRef Id="CMP_dosomething_exe" />
<ComponentRef Id="CMP_dosomething_ini" />
<ComponentRef Id="CMP_eula_doc" />
<ComponentRef Id="CMP_StartMenuShortcut" />
<ComponentRef Id="CMP_DesktopShortcut" />
</Feature>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize" />
<InstallExecute After="RemoveExistingProducts" />
</InstallExecuteSequence>
<UIRef Id="WixUI_Mondo" />
</Product>
</Wix>发布于 2017-01-18 14:19:06
在组件元素上,可以添加: RemoveFile、RemoveFolder、RemoveRegistryKey和RemoveRegistryValue元素。请参阅http://wixtoolset.org/documentation/manual/v3/xsd/wix/component.html
例如(用于文件夹和键):
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="AppName $(var.Version)">
<Component Id="ProgramMenuDir" Guid="*">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue id= Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
<RemoveRegistryKey Id='RegCleanup' Root='HKCU' Action='removeOnInstall' Key='Software\[Manufacturer]\[ProductName]'/>
</Component>
</Directory>
</Directory>如果不重写父组件目录,则可以省略directory属性。
据我所知,RemoveFolder组件的Id应该与要删除的目录的Id相匹配(这对我适用)。
在你的例子中,这会转化成这样的东西:
<Directory Id="LocalAppDataFolder">
<!-- perUser case, it is redirected automatically to LocalAppDataFolder -->
<Directory Id="ProgramFilesHK" Name="$(var.Manufacturer)">
<Directory Id="APPLICATIONFOLDER" Name="$(var.ApplicationName)">
<Component Id="CMP_dosomething_exe" Guid="0BA6F4AB-9ED4-4CF2-BDFF-0C95F1DF4BA0" Permanent="no">
<CreateFolder />
<RemoveFolder Id="ProgramFilesHK" On="uninstall" />
<RemoveFolder Id="APPLICATIONFOLDER" On="uninstall" />
[removed stuff]
</Component>
</Directory>
</Directory>
</Directory>https://stackoverflow.com/questions/41720013
复制相似问题