So, now we want to add something to this project.
(sorry for the rename here to MyServiceTest, but I got distracted and had to come back and rename the project) Now, you should see that you have the service in your services panel (you can get there by going to control panel / Administrative / Services or simple run “services” from your start button.
#Create installer for windows application visual studio 2010 install#
You should get some messages that end with “The Commit phase completed successfully”, then “The Transaction install has completed”. InstallUtil WindowsServiceCreateSample.exe To install the service, enter the command:
Open that folder with the Visual Studio Command Prompt (elevated as admin). Now, rebuild your project and you’ll get an exe file in your /bin/Debug folder. I’m naming my service “MyDoNothingService”. Then, on the other gear “serviceInstaller”, change the nanes as follows. You should have a screen that looks like the following: Select “serviceProcessInstaller1” and in it’s properties window change the account to “LocalSystem”. They are “serviceProcessInstaller1” and “serviceInstaller1” as follows: Now, you’ll get to “gear” icons that you can set properties for. Once the project is created, make sure you have the design surface up for Service1 and right click on it and say “Add Installer”. You can find them all here: Ĭreate a new Visual Studio Project of type “Windows Service”
Microsoft has given us a pretty good set of docs and walk through. In my personal case, my thread has a while(true) loop which keeps looking for new work and only completes when certain conditions are met (like a fatal error that is non recoverable). I realize this is not that useful, but basically, it covers the case of building a service that actually does something and when finished stops. The goal is to create a simple Service in Windows 7 (or other similar OS’s) with Visual Studio 2010 that simply starts, sleeps for 15 seconds, then stops.