简体   繁体   中英

I want to call an installer class on a button click in C#. Is it possible?

如何在按钮单击事件上调用安装程序类,该事件从注册表读取并在C#中的注册表中写入值?

This cannot be done with a single custom action. You should have 2 separate custom actions:

  • one which is executed on button click and reads information from registry
  • another one which writes information in registry during install

The second action needs Administrator privileges and should run as deferred with no impersonation in InstallExecuteSequence.

Assuming you want to set installer properties based on what is read from registry, using an Installer Class is not really an option. I recommend using a DLL custom action which gets a handle to the installer session. You can find a tutorial here: http://www.codeproject.com/KB/install/msicustomaction.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM