Specify Windows Service Name on install with Setup Project
Posted
by sympatric greg
on Stack Overflow
See other posts from Stack Overflow
or by sympatric greg
Published on 2009-07-01T19:27:04Z
Indexed on
2010/03/28
20:53 UTC
Read the original article
Hit count: 398
Objective: In support of a Windows Service that may have multiple instances on a single machine, use a Setup Project to create an MSI capable of:
- Receiving user input for Service Name
- Installing service
- Serializing Service Name from 1 (so that the proper name can be used in logging and uninstall)
My initial hope was to set Service Name in App.config (and then retrieve it during uninstall upon instantiation of the ServiceInstaller. This seems to have been naive, because it is not accessible during the install.
If MyInstaller extends Installer, it can call base.Install(); however, my attempts to write to app.config (within MyInstaller.Install() and after base.Install()) are inneffective.
So while the service can be installed with a custom Service Name, that name is not serialized and the installer is most displeased upon uninstall.
How should this be done?
© Stack Overflow or respective owner