Dear Experts,
I have a windows service that is written in vb.net/.net 4.0. This is how I use the windows service.
1. I install seven instances of the same service on multiple servers. Each service reads an application settings value called process id (one value from 1 through 7). When the service processes data, it reads data belonging to that specific process id. That way I can run seven instances of the same service independently without any instance stepping any other instance.
2. The system administrators at my company want seven different installer (.msi) files, one for each windows service. So I have seven copies of the same windows service project. Each service has its own service installer and service process installer. Also, each windows service project has its own setup project. So I set the configuration value (process id) and service name for each windows service and execute a build for each service.
As you can see, this is not the most efficient way of implementing this. So I looked at this solution:
http://www.codeproject.com/Articles/21320/Multiple-Instance-NET-Windows-Service
While I was able to implement this fairly easily, I cannot use installUtil (system administrators do not want to use it). I still want to build multiple installer (.msi) files but not have to keep multiple copies of code. Also, the seven services are installed across three servers and so I cannot package all seven services in one .msi file.
Is there a way I could keep one copy of the service and generate seven (or more instances controlled by a script or configuration file) different .msi files, one for each instance of the service?
My ideal solution will be to have some kind of a script that will accept number of services as a parameter and then generate one .msi file for each instance of the service. I am leaning towards PowerShell but don't know how difficult it will be in PowerShell. Also, I'd like to keep just one copy of the windows service code.
Sorry my question's description is a bit long but I wanted to make sure I document all the facts.
Thanks for your help.
You program always reads the service name from the configuration file as shown in the link you posted.