I have 3 projects in my VS solution. One of them is a Web app, the second one is a Windows Service and the last one a Setup project for my Web app.
What I want is by the end of the installation of the web app in my setup project, within my custom action to try and install my windows service given that I have the location of the assembly by then.
Please have a look at this article.
Sometimes you may want to install a Windows Service programmatically, but the target machine does not have InstallUtil.exe.
Add a reference to
System.Configuration.Install
Use the code below.
Note that the
exeFileName
is the InstallerClass .exe and not the ServiceClass .exe.To uninstall:
By using the Topshelf project you can install by calling your executable:
Topshelf also takes care of other Windows Service plumbing.