我用wix创建了一个msi文件,允许用户选择目标目录。安装是正确的。
当用户选择非默认目标目录时,卸载不会删除所有文件。
我不使用WixUI_InstallDir。
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PEFiles">
<Directory Id="Company" Name="My Company">
<Directory Id="INSTALLDIR" Name="My Product Default">
<Directory Id="DOC" Name="Doc">
<Dialog Id="BrowseDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="PathEdit" Type="PathEdit" X="84" Y="202" Width="261" Height="18" Property="_BrowseProperty" Indirect="yes" />
<Control Id="OK" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Text="[ButtonText_OK]">
<Publish Event="SetTargetPath" Value="[_BrowseProperty]">1</Publish>
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
</Dialog>
InstallLog:
MSI (c) (38:44) [10:03:19:521]: PROPERTY CHANGE: Adding INSTALLDIR property. Its value is 'C:\Program Files\My Company\My Product Default\'.
MSI (c) (38:3C) [10:03:27:680]: PROPERTY CHANGE: Adding _BrowseProperty property. Its value is 'INSTALLDIR'.
Action 10:03:27: BrowseDlg. Dialog created
MSI (c) (38:3C) [10:03:39:099]: PROPERTY CHANGE: Modifying INSTALLDIR property. Its current value is 'C:\Program Files\My Company\My Product Default\'. Its new value: 'C:\Program Files\My Company\My folder\'.
MSI (c) (38:3C) [10:03:39:209]: PROPERTY CHANGE: Modifying DOC property. Its current value is 'C:\Program Files\My Company\My Product Default\Doc\'. Its new value: 'C:\Program Files\My Company\My folder\Doc\'.
...
UninstallLog:
MSI (s) (48:6C) [10:22:34:485]: PROPERTY CHANGE: Adding INSTALLDIR property. Its value is 'C:\Program Files\My Company\My Product Default\'.
MSI (s) (48:6C) [10:22:34:485]: PROPERTY CHANGE: Adding DOC property. Its value is 'C:\Program Files\My Company\My Product Default\Doc\'.
正常安装/卸载其他组件。在卸载期间,某些组件的路径设置为默认路径而不是用户选择的路径。
如何解决卸载问题?
编辑: 我使用WIX 3.5.2519.0。
答案 0 :(得分:0)
假设您在卸载期间未使用该对话框,则安装期间您选择的值不会保存在安装程序的任何位置。这意味着在卸载时它使用所有默认值。
解决此问题的一种方法是在安装期间将用户选择保存在注册表项中,然后在卸载期间读取该密钥。