To give custom display name, description, start up type and other installation instructions to service, we need to add the Installer class to the service. The following steps will let you know how to do that.
Note: To get the custom name and other installation instructions we need to install the service through visual studio command prompt, otherwise it will not consider the instructions (if we install using sc.exe from windows command prompt)
- Double click on Service1.cs -> Design page will be opened
- Right click on Service1.cs and select Add Installer -> ProjectInstaller.cs page will be added
- Right click on serviceInstaller1 and select properties and set the properties of name, descripiton, ....
Set the properties values as shown in the below image
- Right click on serviceProjectInstaller1 and select properites -> and change Account to LocalSystem
- Re Build the application
- Now to install the service, open visual studio command prompt in Run as administrator
- type -> cd %systemroot%\Microsoft.NET\Framework\v4.0.30319\ -> and click enter
- type -> installutil F:\Delete\SampleSolution\Sample\WindowsServiceExample\bin\Debug\WindowsServiceExample.exe -> and click enter
- Now open the service list and see the service name and description
You may need to change the path %systemroot%\Microsoft.NET\Framework\v4.0.30319\
according to your .NET Version.