web analytics

Installing a Windows Service using InstallUtil.exe

Options

codeling 1602 - 6666
@2016-06-16 14:55:54

This post shows how to install or uninstall a Windows Service written in .NET using C#. To install or uninstall Windows Service (that was created using the .NET Framework) use the utility InstallUtil.exe.

When running InstallUtil.exe it has to be run from the .Net folder matching your machines setup, for instance if you have a 64Bit machine you have to run InstallUtil.exe from the 64Bit .Net folder “C:\Windows\Microsoft.NET\Framework64 \v4.0.30319\InstallUtil.exe” and for a 32Bit machine you can use the normal .Net folder “C:\Windows\Microsoft.NET\Framework\ v4.0.30319\InstallUtil.exe”

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
@2016-06-16 14:57:34

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 Commit method.

  • assemblyname.InstallState - Contains data used to uninstall the assembly.

@2016-06-16 14:58:24

Starting with the .NET Framework version 2.0, the 32-bit version of the common language runtime (CLR) ships with only the 32-bit version of the Installer tool, but the 64-bit version of the CLR ships with both 32-bit and 64-bit versions 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 (MSIL) assemblies. Both versions of the Installer tool behave the same.

@2017-03-10 14:12:25

If you’re using the Visual Studio command prompt, InstallUtil.exe should be on the system path. If not, you can add it to the path, or use the fully qualified path to invoke it. This tool is installed with the .NET Framework, and its path is %WINDIR%\ Microsoft.NET\Framework[64]\<framework_version>.

For example, for the 32-bit version of the .NET Framework 4 or 4.5.*, if your Windows installation directory is C:\Windows, the path is C:\Windows\Microsoft.NET \Framework \v4.0.30319\InstallUtil.exe.

For the 64-bit version of the .NET Framework 4 or 4.5.*, the default path is C:\Windows\Microsoft.NET\Framework64 \v4.0.30319\InstallUtil.exe.

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com