1

I've a Console Application project in a Visual Studio Solution. This application, called here for semplicity MyApplication.exe, is nothing but an host of a WCF Service.

I need an installer for install my application on the target machine, so I download the Microsoft Visual Studio Installer Projects extension. I collected all the files I want to be copied into the Application Folder but I want that the installer even registers my service as a Windows Service.

For this goal, I imported the InstallUtil.exe just like shown on the below picture. I created the nested extra folders (Windows Folder -> Microsoft.NET -> Framework64 -> v4.030319) in order to reflect the actual structure of the target environment.

enter image description here

Then I created the Custom Action like this under the Commit node:

enter image description here

with the following Arguments:

"[TARGETDIR]MyApplication.exe"

I tried the generated setup and I noticed that all the files are copied but the service is not installed (I don't see it on the MSC list).

So, below my questions:

  • Where and what am I doing wrong?
  • Is there any log I can check?
  • In which way I can uninstall the service, if it was already installed previously?
  • Frankly speaking, I expected something more customizable.. For example additional checkbox related to my application or something that the user can manage at installation time. If my App.config contains a KeyValue [Server="localhost"] is there a way to customize it at installation time with a popup to the user: 'Where is your server?" and update my config file with the information prompted by the user?
user2896152
  • 670
  • 1
  • 8
  • 26

2 Answers2

0

Limits: Visual Studio Installer Projects have many limitations (short version, Chris Painter).

Alternative Tools: There are many other tools, some of which are free.


WiX Toolkit: The WiX Toolkit is free and open source. Here are two examples of how to install services without the need to run custom actions (the ability to install services is built-in to MSI, no need to use InstallUtil.exe - the "say no" to unnecessary custom action campaign):


Links:

Stein Åsmul
  • 34,628
  • 23
  • 78
  • 140
0

Perhaps this will be useful to someone in a similar situation.

Using Statement

using System.Configuration.Install;

Installing

ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });

Uninstalling

ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });

The above handles the functionality for the InstallUtil you've mentioned.

Documentation

ManagedInstallerClass.InstallHelper

Documentation on InstallUtil

The utility is located in the following places:

.NET directories on a Windows system:

  • C:\Windows\Microsoft.NET\Framework\v \InstallUtil.exe
  • C:\Windows\Microsoft.NET\Framework64\v \InstallUtil.exe

InstallUtil.exe is digitally signed by Microsoft.

eyegropram
  • 672
  • 4
  • 11