How to run a Custom Action inside an MSI created i

2019-02-23 16:03发布

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

2条回答
劳资没心,怎么记你
2楼-- · 2019-02-23 16:07

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.

查看更多
姐就是有狂的资本
3楼-- · 2019-02-23 16:26

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

查看更多
登录 后发表回答