Click this link, to download source code. |
This example is especially useful for projects that contain several services that use common code bases. For example, I have a service suite that monitors several FTP drop directories on a server. Each watcher performs different, custom actions; but, 90-95% of the code is common to all services. For this and other reasons not discussed here, it makes sense to simply package all services in one project. The more popular alternative is to create a common library, install to GAC, and create individual service solutions.
The bottom line is that I wanted to simplify management and deployment. To simplify service registration, I created a "ServiceInfo" class attribute into which all service information is entered, instead of mucking about in several ProjectInstaller files. View the full article, to get source code and a complete walk-through.
UPDATE 13 MAR 2012: I updated the code sections, to use formatted HTML, instead of using JavaScript code coloring. The code was formatted a bit, for fit, and to make the LINQ more efficient. Therefore, the code in the download won't be exactly the same, but it works.