Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 733
Nicros Avatar asked Aug 01 '26 22:08

Nicros


1 Answers

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.

like image 173
rmrrm Avatar answered Aug 04 '26 12:08

rmrrm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!