vikasb
Posts: 9
Joined: Thu May 28, 2020 11:20 am

How to create installer project for C# windows service

I want to create installer for Windows service.
It should install this service, Start service and while uninstalling it should stop window service and uninstall it from system.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: How to create installer project for C# windows service

Hello and welcome to Advanced Installer forums,

In order to install a service, all you need to add the service executable in your project and then go to "Services" page --> "New Service" button from the toolbar --> select the executable.
It should install this service, Start service and while uninstalling it should stop window service and uninstall it from system.
This is exactly the default behavior.

Additionally, please note that the setup package must be run with administrative privileges, because creating and starting a Windows Service requires them (administrative privileges).

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vikasb
Posts: 9
Joined: Thu May 28, 2020 11:20 am

Re: How to create installer project for C# windows service

Thanks for reply Catalin
This really helped me.
Catalin wrote: Thu May 28, 2020 11:54 am Additionally, please note that the setup package must be run with aAdministrative privileges, because creating and starting a Windows Service requires them (administrative privileges).
Now I am able to install the service but it does not require Administrative privileges.
How can I put restriction on installation that, it should require Administrative privileges?
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: How to create installer project for C# windows service

You are always welcome!

I am really glad I could help.
How can I put restriction on installation that, it should require Administrative privileges?
You can achieve this by going to "Install Parameters" page and checking the "Run as administrator" option. This will run your package as administrator and, if the user is not administrator, it will prompt him for the administrator credentials.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”