为所有用户安装可选的桌面快捷方式 [英] Install optional desktop shortcut for all users

查看:98
本文介绍了为所有用户安装可选的桌面快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个 wix 安装程序,为所有用户提供一个可选桌面快捷方式.可选的意思是,我不能把它放在主exe的component中,而是放在一个单独的component中,这样我就可以设置一个单独的feature为快捷方式.

I want to make a wix installer, with an optional desktop shortcut for all users. Optional means, I cannot put it in the component of the main exe, but in a separate component, so that I can set a separate feature for the shortcut.

这样做时,wix 会抱怨:

When doing this, wix complains:

错误 LGHT0204:ICE38:组件桌面快捷方式安装到用户配置文件.它必须使用 HKCU 下的注册表项作为其 KeyPath,而不是文件.

error LGHT0204 : ICE38: Component DesktopShortcut installs to user profile. It must use a registry key under HKCU as its KeyPath, not a file.

所以我设置了一个这样的附加注册表项:

So I set an aditional registry key like this:

<Component Id="DesktopShortcut"  Guid="767f3e19-9a7d-4793-9782-75516494a57c">
    <Shortcut Target="[APPLICATIONROOTDIRECTORY]ocean.exe" Id="OceanShortcutDesktop" Name="$(var.ProductName)" WorkingDirectory='APPLICATIONROOTDIRECTORY' Icon="OceanIcon"/>
    <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]\installs' Name="desktopshortcut" Type='string' Value='' KeyPath='yes' />
</Component>

快捷方式进入所有用户",因为我设置了 ALLUSERS=1 属性.但是,注册表没有等效项,并且密钥位于当前(正在安装)用户注册表中.恕我直言,这是一个问题:如果用户配置文件被删除,则卸载时不会再删除快捷方式.

The shortcut goes in "All Users" since I set the ALLUSERS=1 property. However, there is no equivalent for registry, and the key goes in the current (installing) user registry. This is IMHO an issue : if the user profile gets deleted, the shortcut will not be deleted anymore on uninstall.

改用HKLM"会导致 wix 错误(混合每用户和每台机器):

Using "HKLM" instead causes an error in wix (mixing per-user and per-machine):

错误 LGHT0204:ICE38:组件桌面快捷方式安装到用户配置文件.它的 KeyPath 注册表项必须属于 HKCU.

error LGHT0204 : ICE38: Component DesktopShortcut installs to user profile. It's KeyPath registry key must fall under HKCU.

这对于 wix 来说非常愚蠢,因为所有用户"组件应该链接到机器,而不是普通用户,因为没有所有用户"注册表.

This is quite stupid from wix, as "All Users" component should be linked to the machine, and not to a normal user, as there is no "all users" registry.

有什么想法吗?

推荐答案

您可以尝试将注册表根目录更改为HKMU"(据我所知,当安装是每台机器时,它应该写入 HKEY_LOCAL_MACHINE 并且如果不是,则在 HKEY_CURRENT_USER 下).

You can try to change the registry root to 'HKMU' (From what I remember it's supposed to to write to the HKEY_LOCAL_MACHINE when the install is per-machine and under HKEY_CURRENT_USER when its not).

如果您将根目录更改为HKMU",您将收到 ICE57 错误(组件DesktopShortcut"具有每个用户的数据和一个可以是每个用户或每个机器的密钥路径.)

If you change the root to 'HKMU' you will get the ICE57 error (Component 'DesktopShortcut' has both per-user data and a keypath that can be either per-user or per-machine.)

您可以取消此错误,安装程序将创建所有用户快捷方式(当我尝试时它有效,但我不确定这是最好的方法).

You can suppress this error and the installer will create all-users shortcut (It worked when I tried it, but I'm not sure it's the best way to do this).

(要禁用 ICE57 错误,请参阅:如何修复 ICE57.Per-用户安装)

(To disable the ICE57 error see: How to fix ICE57.Per-User installation)

这篇关于为所有用户安装可选的桌面快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆