Share via


Installer Tool (Installutil.exe)

The Installer tool is a command-line utility that 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 

Remarks

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.

/?

Displays command syntax and options for the tool.

/? 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.

/AssemblyName assemblyName

[,Version=major.minor.build.revision]

[,Culture=locale]

[,PublicKeyToken=publicKeyToken]]

Specifies the name of an assembly. The assembly name must be fully qualified with the version, culture, and public key token of the assembly. The fully qualified name must be surrounded by quotes.

For example, "myAssembly, Culture=neutral, PublicKeyToken=0038abc9deabfle5, Version=2.0.0.0" is a fully qualified assembly name.

/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.

Remarks

Starting with the .NET Framework version 2.0, the 32-bit version of the common language runtime (CLR) continues to ship with only the 32-bit version of the Installer tool, but the 64-bit version of the CLR ships with both a 32-bit and a 64-bit version of the Installer tool. When using the 64-bit CLR, use the 32-bit Installer tool to install 32-bit assemblies, and the 64-bit Installer tool to install 64-bit and Microsoft intermediate language assemblies. Otherwise, both versions of the Installer tool behave the same.

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.

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.

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.

Installutil.exe can not install or uninstall delay signed assemblies, but can install or uninstall strong named assemblies.

Note that you cannot deploy a Windows service created using 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 C++ Windows service with Installutil.exe, an exception such as BadImageFormatException will be thrown. To work with this scenario, move the service code to a 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 installer components in an assembly using the /AssemblyName switch and a fully qualified name.

installutil /AssemblyName "myAssembly, Culture=neutral, PublicKeyToken=0038abc9deabfle5, Version=2.0.0.0"

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

Reference

.NET Framework Tools

System.Configuration.Install

SDK Command Prompt