views:

2450

answers:

4

I've created a windows service in c#, using Visual Studio 2008 I pretty much followed this: http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx

I created a setup project, as instructed to in the article, and ran it... it installs my service to c:\program files\product etc.... however, it does not then appear in the services list..

What am i missing?

+1  A: 

Follow these instructions, they worked for me. For the setup specifically, that part is near the bottom of the article.

MSDN: Walkthrough: Creating a Windows Service

Jon Seigel
+6  A: 

The most important part of the article you linked, is here

To add a custom action to the setup project

1.In Solution Explorer, right-click the setup project, point to View, then choose Custom Actions. The Custom Actions editor appears.

2.In the Custom Actions editor, right-click the Custom Actions node and choose Add Custom Action. The Select Item in Project dialog box appears.

3.Double-click the application folder in the list box to open it, select primary output from MyNewService (Active), and click OK. The primary output is added to all four nodes of the custom actions � Install, Commit, Rollback, and Uninstall.

4.Build the setup project.

If you skip these steps, your setup project will build and copy your files to the correcet directory; however, they will not register your binary as a service without these steps.

Nate Bross
Is there any way to start the service as part of the install as well? I know you can configure StartType to Automatic, but that only starts the service after a restart.
Taylor Leese
A: 

I got owned in the face by this one, so I'm putting it here just in case anyone else runs into it.

If you followed the instructions in the guides but are still having issues installing, ensure your Installer class is public. Internal won't work.

Sam Pearson
A: 

Hi. I followed this example, but it still won't show as a service when I install it.

I'm on win7, vs 2008 and I run the installation from vs.

It runs the installation without problems, at first it asked for credentials for the user account that should be used to run the service, but I changed the installer to set it to localuser and now the installation runs without interruptions. but as I said, it won't show in the list of services.

edit: Nevermind... worked it out. can't find a button to just remove this post, so I'll just edit it instead...

Stefan