问题
I'm currently using the Qt-Installer-Framework to create a setup for my application. Everything works fine for now except one thing:
If I install it to any location but C:\Program Files\MyApp
, the installer won't create the registry entry for Programs and Features
!
Is there a way to tell the installer to always do this?
Edit:
After trying out vairous different combinations, I do know now where the problem comes from:
If I try to install as current user only (set the AllUsers
variable to false
), it will always work and create an entry in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{GUID}
.
If I install for all users, however, it will try to create a key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{GUID}
. This will only work, if the installer has to elevate it's operations during installation (because I chose a directory I need admin rights for).
So, the error is: The installer won't elevate itself to create the "global" registry entry and thus fails to create it. Any ideas on how to fix it?
回答1:
Here the link which has answer to this question.
Add the following line to your component's package xml file:
@<RequiresAdminRights>true</RequiresAdminRights>@
And use this line in your script file:
@component.addElevatedOperation("Execute", "someCommand");@
instead of
@component.addOperation("Execute", "someCommand");@
来源:https://stackoverflow.com/questions/34863638/qtifw-always-create-registry-entry