How to run a Custom Action inside an MSI created in WiX with elevated privileges?

孤街浪徒 提交于 2019-12-01 19:08:41

问题


I have an installer that needs to access the registry and copy and remove files using custom actions. In Windows XP the installer works just fine, but in Vista and 7, the installer shows an error because it cannot access a folder, but if I run the installer as administrator everything works.

So, I need the installer to be able to run the custom action as administrator even if the MSI wasnt run this way (need the installer to be run by regular users). I tried using an EXE at the beginning of my installation to modify the registry and allow the MSI to run normally but I dont think that's a very good solution.

PS. Bootstrapper is not an option due to client requirements :S All my custom Actions are deferred and impersonate="no"

Any ideas? Thank you


回答1:


Make sure that:

  • it's scheduled after InstallInitialize
  • "Execute" attribute is set to deferred
  • "Impersonate" attribute is set to no

Please note that deferred custom actions cannot access the installation session, so you cannot access installer properties directly.




回答2:


Your Custom Actions must be sequenced between InstallInitialize and InstallFinalize actions.

Do you get UAC prompt when you run the installer? If you perform a per-machine install, you would get UAC prompt when you click Install button in the wizard. If you don't get UAC prompt, then check ALLUSERS property is set to 2. See also Marking the Privileges for an MSI



来源:https://stackoverflow.com/questions/5476779/how-to-run-a-custom-action-inside-an-msi-created-in-wix-with-elevated-privileges

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!