带 WiX 的安装程序(由管理员预安装并由用户更新)?
我们使用 WiX 创建了一个安装程序。 在注册表中,我们将其保存在 HKCU 下(参见示例)。 桌面图标和所有内容都是为当前用户安装的。
<DirectoryRef Id="INSTALLDIR">
<Component Id="CMP_SaveInstallDir" Guid="52e5e617-2c9a-4514-a6b0-055e4adc6a0b">
<RegistryValue Id="MyInstallDirId" KeyPath="yes" Action="write" Root="HKCU" Key="Software\ABC\MyProduct" Name="MyProduct" Value="[INSTALLDIR]" Type="string" />
</Component>
</DirectoryRef>
对于升级,我们还使用 WiX。我们尝试查找注册表项,如果可用,我们将安装升级。 如果安装完整安装程序的人安装了升级安装程序,那么效果很好。
现在安装程序还应该用于在某些计算机上预安装该软件。这意味着,管理员用户(“Joe Admin”)安装该软件。 稍后,普通用户(“Pete 用户”,有权安装软件)应该能够安装升级。
但由于完整安装是由“Joe Admin”完成的,“Pete User”无法使用升级安装程序进行升级,因为在他的注册表中找不到注册表项(“Pete User”的 HKCU)。
我认为这种情况并不罕见,所以我希望有人可以帮助我找到解决方案。
提前致谢!
We've created an installer using WiX.
In the registry we save it under HKCU (see example).
Desktop Icons and everything is installed for the Current User.
<DirectoryRef Id="INSTALLDIR">
<Component Id="CMP_SaveInstallDir" Guid="52e5e617-2c9a-4514-a6b0-055e4adc6a0b">
<RegistryValue Id="MyInstallDirId" KeyPath="yes" Action="write" Root="HKCU" Key="Software\ABC\MyProduct" Name="MyProduct" Value="[INSTALLDIR]" Type="string" />
</Component>
</DirectoryRef>
For upgrades we also use WiX. We try find the registry key and if it is available we install the upgrade.
That works well, if the person who installed the full installer installs the upgrade installer.
Now the installer should also be used to pre-install the software on some computers. That means, an Admin user ("Joe Admin") installs the software.
Later on a normal user ("Pete User", with the right to install software) should be able to install an upgrade.
But as the full install was done by "Joe Admin", "Pete User" can't upgrade with an upgrade installer as the registry key can't be found in his registry (HKCU of "Pete User").
I think that this scenario isn't unusual and so I hope someone can help me to find a solution.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一篇可能对您有帮助的文章: http://setupanddeployment.com/installation-environment/peruser -permachine/
基本上,您错误地处理了安装位置。如果您的安装是每台计算机(对于所有用户),则它应该仅使用每台计算机的位置。 HKEY_CURRENT_USER 是每用户位置,在每台计算机安装程序中使用它是一种不好的做法。因此你的问题。
Here is an article which may help you: http://setupanddeployment.com/installation-environment/peruser-permachine/
Basically, you are handling the install locations incorrectly. If your installation is per-machine (for all users), it should use only per-machine locations. HKEY_CURRENT_USER is a per-user location and using it in a per-machine installer is a bad practice. Hence your problem.
我认为Cosmin是对的< /a> 并且在这种情况下您必须使用每台计算机安装。
毕竟,如果 Joe Admin 安装了该应用程序,则只有该用户有权访问它:桌面图标、程序文件及其设置都存储在管理员配置文件中。因此,Pete 用户无权访问应用程序的任何组件。
因此,要么在每台机器上进行安装,要么允许用户安装(不仅仅是升级)。
I think Cosmin is right and you have to use per-machine installation in this case.
After all, if Joe Admin installed the application, then only this user has access to it: the desktop icons, program files and its settings are stored in the admin profile. Therefore Pete User has no access to any components of the application.
So either you make the installation per-machine or allow users to install it (not only upgrade).