开发者

Installer OnCommitted question

开发者 https://www.devze.com 2023-02-20 16:21 出处:网络
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 Service

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号