What is the best way to create a Windows.NET installer?

I just created a simple .NET Windows service. My users must download it from my site and install it on their computers. Therefore, from various forum posts (including this site), I know that for this I need an installer. Or I can just provide them with service files and indicate how to install them. I started by creating an installation project and was able to compile my own .msi installer. But one user complained that he could not delete it now. I examined it and found that the .msi format has some problems, mainly related to the way it considers links in the GAC. However, it was very easy to help him fix his computer. From my conversations with users, I know that it would be almost impossible to train them in using sc.exe or installutil.exe. I also found a service at http://installer.codeeffects.com that can build an installer for my service without any code, but I'm not sure if my installer needs msi or exe. So, it is clear that I am in complete confusion here :) Please help the guys, any general or detailed advice will be highly appreciated.

+4
source share
5 answers

Ask your service to accept the argument for registering yourself as a service:

MyService.exe /i 

In your service you check this argument and, if there is one, get a service for registration:

 ManagedInstallerClass.InstallHelper(args); 

See my answer to this question for more details. Thus, you can force the user to register the service through the command line.

If it is still too complicated for your users, you can use Environment.UserInteractive to check if the user has been double clicked on this service. If so, install / uninstall the service. If not, start the service (this will be the route that starts when the service starts through the services applet and when the machine starts).

+6
source

Why aren't you using the VS built-in installer? I have used this for many years.

The problem (and the reason you think it is not working) is that for the Windows service you need to add some custom actions so that the service can register.

Take a look at this and then on β€œAdd” to the project project section:

http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx

+2
source

My suggestion would be MSI to install the files in the right place, including the batch files that run installutil.exe. Then follow the post-installation steps that execute the batch files.

And to remove the same approach - batch files are executed as a preliminary uninstall step, and then deleted. I used to have to do something like that. And I know this is a pain.

0
source

Here is a really cool walkthrough to create a service installer using Visual Studio 2005. (Almost identical in Visual Studio 2008).

http://aspalliance.com/1316_Working_with_Windows_Service_Using_Visual_Studio_2005.all

It really helped me: D

0
source

I think you can separate the service from your application. Ask the service to call the executable file with the actual application logic, and you can support the executable by reinstalling it several times without removing or reinstalling the application maintenance part.

This comes from a person who is tired of talking to a Microsoft installer. You can get a much better answer from an experienced installer guru. I'm not sure I'm waiting for this. I have a similar problem and this will probably be my approach related question .

-1
source

Source: https://habr.com/ru/post/1300937/


All Articles