31 out of 91 rated this helpful - Rate this topic

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.

/?

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.

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.

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
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Is it allowed to distribute installutil.exe in your setup package?
I am creating a setup package and I need installutil.exe to install some assemblies. Because installutil.exe is not available on every system I want to include it in my setup package. Is it allowed to distribute installutil.exe?
System.Security.SecurityException: The source was not found...
This is a REPLY TO THE FOLLOWING comment made by another user:

not working on server 2008! throws an exception and rollsback

here is the error:

An exception occurred during the Install phase.
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

happens with autolog false or true.

the service has no event log code.

so ither server 2008 is to secure or the installutill.exe needs a patch.

In answer to this:

Don't forget to install using elevated permissions if you're using Automatic Logging (you can always turn it off in the Properties for your service), this attempts to create an event source, and can't do so unless you're running from an elevated command prompt (Run as Administrator).

Failing to do so will raise the SecurityException you mentioned.

Hope this helps.

//-------------------------------------------------------------------------------
find the Visual Studio Command Prompt on the Start Menu and Right-Click to run as Administrator. 
This worked for me.

windows server 2008 seems to use the 32 bit installutil
During install, it throws an exception (during customs action) and in the event log says "The error code is 2869". If I remove all the customs action, I can install the service and manually use the installutil under C:\Windows\Microsoft.NET\Framework64\v2.0.50727 to register the service. How can I make the installer to use the correct installutil?

[tfl - 21 06 10] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell : http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
SQL Server : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C&
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
Windows : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.windows%2C&
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&


Answer please
Can someone from Microsoft please answer Xiphos question regarding if it is allowed to distribute installutil.exe with packages? in server 2008 c# 3.5 Thanks. Abrar.

[TFL 21 6 2010]
MS staff can not actually answer this question - you need to consult the EULA and if still in doubt, contact your lawyers. Sorry if this is not answer you want.
How to pass parameters to my custom service (created in .net)
I want to pass some parameters to my custom service. How can I do this?

[tfl - 21 06 10] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell : http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
SQL Server : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C&
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
Windows : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.windows%2C&
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&


use search or follow link

well ... you do need the .net framework for your service, right?

the installutil is included in the redistributables!

http://msdn.microsoft.com/en-us/library/50614e95(VS.80).aspx

i hope this answers your question! :)

windows server 2008 - installutil SecurityException fix
You need to run this with elevated privileges. I'm not aware of the shortcut yet, but just by messing around, you can right click on C:\windows\Systemwow64 (or system32)\cmd.exe and select Run As Administrator.

Then change directories and run installutil -i as you would normally.
not working on server 2008! throws an exception and rollsback

here is the error:

An exception occurred during the Install phase.
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

happens with autolog false or true.

the service has no event log code.

so ither server 2008 is to secure or the installutill.exe needs a patch.