Thursday, January 19, 2012

Windows Services and Creating a Setup Project

I want to create a constructive post on this with a full explanation on how to create a setup project for anything, my main example will use a windows service since I think there is a lot more configuration to worry about with Windows Services. In the mean time here are a bunch of great links that helped me put together my Windows Service:
  1. Search for "Create a Setup Project for a Windows Service" on this page http://support.microsoft.com/kb/816169 - This gives you a step by step on how to create the installer project.
  2. This link explains that your Installer will only let you install a single instance at a time. You cannot install multiple instances using the same installer without jumping through some major hoops it seems. http://stackoverflow.com/questions/5597487/setup-project-for-windows-service-with-multiple-instances 
  3. If you keep getting a prompt for UserName and Password then you might want to consider making the installer default to using the LocalSystem as the user to run the windows service here is how you do that : http://social.msdn.microsoft.com/Forums/en/winformssetup/thread/229b32cb-c97d-4c77-8bdb-fdabe533655c
  4. Here is how you auto start your windows service after the installation is finished. http://pietschsoft.com/post/2009/11/06/dotNet-Windows-Service-Installer-And-Auto-Start-After-Installation.aspx
  5. Here is how you would specify user input during the installation but I recommend not doing this is you don't have to it just seems like way more trouble than it is actually worth doing. http://stackoverflow.com/questions/1070885/specify-windows-service-name-on-install-with-setup-project
Additional Tips
I realized that a huge chunk of the setup options that you are looking for are all in the properties window in visual studio. Of course that properties window will shift its focus when you select certain things so here are some of the places I found myself clicking on the most:
  • Installer Setup Project
  • Installer "ProjectInstaller.cs" Design View
  • Main Windows Service "Service.cs" Design View
  • Any objects visible on the Design View Window such as a Service Process Installer or a Timer.
By click on those things you will find a ton of options you might have otherwise missed or were trying to edit directly in the design view which is not recommended because the changes can be overwritten etc...

Very Common Questions
  • Question: How do I add the Project Installer to my Windows Service Project?

    Answer: The easiest way to achieve this is by going to the design view of your Windows Service (Service.cs etc...) right click on any of the blank space and clicking the "Add Installer" option in the context menu.
  • I don't have anymore to add at this time...

No comments:

Post a Comment