So, now you may have a windows service up and running, but you need to install it... its not as hard as yout think...
1. Goto the service designer GUI, right click, and select "Add Installer", and then .NET will create a "ProjectInstaller.cs" file.
2. Goto the "ProjectInstaller.cs" design view. You will see a ServiceProcessInstaller and a ServiceInstaller.
3. In the properties for the ServiceProcessInstaller, you can configure the Account information. Here you can define whether to run the service as a user, system user or even network service.
4. In the properties for the ServiceInstaller, you can configure the start-type (Manual, Automatic, Disabled etc.) and general settings and names for your service.
5. Once the properties have been setup, these two objects have a series of events which allow any custom actions to be performed before or after setup/uninstall etc. Populate the methods with any custom actions you may require.
6. Now create a new Windows Setup project using the standard template and add it to the current solution. Add the "primary output" from the service project. Then, right click the setup project, select 'View', then 'Custom Actions'.
7. Right click the 'Custom Actions' root node in the main tree view and 'Add custom action'. Select the primary output for the service.
8. Add suitable settings for your installer project, then your done!
No comments:
Post a Comment