Installer Tool (Installutil.exe)

The Installer tool allows you to install and uninstall server resources by executing the installer components in a specified assembly. This tool works in conjunction with classes in the System.Configuration.Install Namespace.

installutil [/uninstall][option [...]]assemblyname ]
[option [...]]assemblyname 
Argument Description
assemblyname The name of the assembly in which to execute the installer components.
Option Description
/h[elp] Displays command syntax and options for the tool.
/help assemblypath Displays any additional options recognized by individual installers within the specified assembly.
/logFile=[filename] Specifies the name of the log file where install progress is recorded. The default is assemblyname.InstallLog.
/logToConsole={true|false} If true, displays output to the console. If false (the default), suppresses output to the console.
/showCallStack Prints the call stack to the log if an exception occurs at any point during installation.
/u[ninstall] Uninstalls an assembly. Unlike other options, /u applies to all assemblies regardless of where it appears on the command line.
/? assemblypath Displays any additional options recognized by individual installers within the specified assembly.
/? Displays command syntax and options for the tool.

Remarks

You can specify multiple assemblies on the same command line. Any option that occurs before an assembly name applies to that assembly's installation. Options specified for one assembly apply to any subsequent assemblies unless the option is specified with a new assembly name.

Microsoft .NET Framework applications consist of traditional program files and associated resources, such as message queues, event logs, and performance counters that must be created when the application is deployed. You can use an assembly's installer components to create these resources when your application is installed and to remove them when your application is uninstalled. Installutil.exe detects and executes these installer components.

If you run Installutil.exe against an assembly without specifying any options, it places the following three files into the assembly's directory:

  • InstallUtil.InstallLog

    Contains a general description of the installation progress.

  • assemblyname.InstallLog

    Contains information specific to the commit phase of the installation process. For more information about the commit phase, see the Installer.Commit Method.

  • assemblyname.InstallState

    Contains data used to uninstall the assembly.

Installutil.exe uses reflection to inspect the specified assembly and find all Installer types with the RunInstallerAttribute set to true. The tool then executes either the Install Method or the Uninstall Method on each instance of the Installer type. Installutil.exe performs installation in a transactional manner; if one of the assemblies fails to install, it rolls back the installations of all other assemblies. Uninstall is not transactional.

Note that you cannot deploy a Windows service created using the Managed Extensions for C++ with Installutil.exe. Installutil.exe cannot recognize the embedded native code that is produced by the C++ compiler. If you attempt to deploy a Managed Extensions Windows service with Installutil.exe, an exception such as BadImageFormatException will be thrown. To work with this scenario, move the service code to a Managed Extensions for C++ module. Then, write the installer object in C# or Visual Basic.

Examples

The following command displays a description of the command syntax and options.

installutil

The following command executes the installer components in the assembly myAssembly.exe.

installutil myAssembly.exe

The following command executes the uninstaller components in the assembly myAssembly.exe.

installutil /u myAssembly.exe 

The following command executes the installers in the assembly myAssembly.exe and specifies that progress information will be written to myLog.InstallLog.

installutil /LogFile=myLog.InstallLog myAssembly.exe 

The following command writes the installation progress for myAssembly.exe to myLog.InstallLog and writes the progress for myTestAssembly.exe to myTestLog.InstallLog.

installutil /LogFile=myLog.InstallLog myAssembly.exe /LogFile = myTestLog.InstallLog myTestAssembly.exe

See Also

.NET Framework Tools | System.Configuration.Install Namespace