Dailycode.info

Short solution for short problems

InstallUtil troubleshoot

When I was un/installing a service on a server I had to use the installutil utility from the .Net framework. I encoutered some problems with this.

1)  'Installutil' is not recognized as an internal or external command,
operable program or batch file.

Solution: The .NET path is not added to the environment variable by default. To use
this tool either navigate to the folder where .NET is installed into (i.e.
c:\windows\Microsoft.NET\framework\..), or open the command prompt that is installed
with VS.NET which sets the environment correctly.

Source: http://bytes.com/groups/net-c/253392-installutil-exe-not-recognized-internal

2) Exception occurred while initializing the installation:
System.BadImageFormatException: The format of the file 'device_manager.exe'
 is invalid.

This means that the installutil that is used by default is the wrong version of the .Net framework. You can browse to the folder of the correct framework and run the installutil from there.

There are several folders available for the different frameworks. Use the highest version your assembly is compiled in. The folders are situated under: (systemdrive):\WINDOWS\Microsoft.NET\Framework and can be the following:

v1.0.3705
v1.1.4322
v2.0.50727
v3.0
v3.5