我正在使用 Wix 3.9 和 Wix-edit 0.7.5/Notepad++ 为我的应用程序创建 MSI 安装程序。我想在已安装的文件夹中创建一个卸载快捷方式。例如:
C:\MySoftware\Uninstall.lnk
我尝试了一些事情,但在所有情况下,当我通过该链接卸载软件时,程序文件夹C:\MySoftware
都不会被删除。以其他方式卸载按预期工作。
首先,我尝试将其创建为<Directory>
标签内的组件。在我看来有点 hacky,因为我必须添加<CreateFolder>
:
<Directory Id="MYINSTALLDIR" Name="MySoftware">
<!-- my files... -->
<Component Id="ABC" Guid="PUT-GUID-HERE">
<CreateFolder/> <!-- have to add this -->
<Shortcut Id="UninstallProduct" Name="Uninstall MySoftware" Description="Uninstalls MySoftware" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]"/>
</Component>
</Directory>
<Feature Id="DefaultFeature" Title="Main Feature" Level="1">
<!-- some references... -->
<ComponentRef Id="ABC" />
</Feature>
我也尝试用 替换<CreateFolder/>
,<RemoveFolder Id="MYINSTALLDIR" On="uninstall" />
结果相同。
另一个尝试:
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="StartMenuShortcuts" Guid="*">
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" />
<Shortcut Id="UninstallProduct1" Name="Uninstall MySoftware" Description="Uninstalls MySoftware" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]"/>
<Shortcut Id="UninstallProduct2" Name="Uninstall MySoftware" Description="Uninstalls MySoftware" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" Directory="MYINSTALLDIR" />
</Component>
</DirectoryRef>
在这里,除了具有相同的结果外,我在构建时收到警告:file.wxs(31) : warning LGHT1076 : ICE57: Component 'StartMenuShortcuts' has both per-user and per-machine data with an HKCU Registry KeyPath.
。
如何创建可以在不影响卸载行为的情况下使用的快捷方式?我不知道它是否有区别,但我需要它在没有管理员权限的情况下工作(我正在使用<Package ... InstallScope="perUser" InstallPrivileges="limited">
)。
我知道我可以创建一个 .lnk 文件并将其添加到项目中,但我不想这样做,因为那样我就不得不担心在每个项目上更新它的 GUID。