简体   繁体   中英

Installer OnCommitted question

I wrote an installer a bit back that installs a service that I wanted to start when the installer finished. I put the code to start the service in the OnCommitted method of the ServiceInstaller. I did this because a lot of searches I found on the topic did it this way, but I remember there were also other ways to do it.

In looking back though, I'm not sure if this was the right thing to do.

In particular, the docs say that OnCommitted gets called after the Commit of the installation. Does that also count for uninstalling? I wouldn't want to be trying to start a service I am uninstalling!

Thoughts?

The recommended approach is to use ServiceControl table . Basically, you create a service control operation which tells Windows Installer to start the service after it's installed.

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