Program which you use to install that service (installutil.exe
) inspects your assembly and runs installers. As stated in its documentation:
Installutil.exe uses reflection to inspect the specified assemblies
and to find all Installer types that have the
System.ComponentModel.RunInstallerAttribute attribute set to true.
The
tool then executes either the Installer.Install or the
Installer.Uninstall method on each instance of the Installer type.
Installutil.exe performs installation in a transactional manner; that
is, if one of the assemblies fails to install, it rolls back the
installations of all other assemblies. Uninstall is not transactional.
Update: You said you do not use installutil
and instead using ManagedInstallerClass.InstallHelper
. Reading documentation of this class:
This API supports the product infrastructure and is not intended to be
used directly from your code.
Handles the functionality of the Installutil.exe (Installer Tool).
So first you should not be using it, and second - it does the same as installutil
(so related to this question - uses reflection to inspect your assembly and run installers). I suppose that installutil
tool actually just calls this method. Note that you have to pass path to your assembly in args
of ManagedInstallerClass.InstallHelper
, that's how it knows which assembly to inspect with reflection and run installer for.