Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net Windows Services and InstallState file - is it really needed?

I've got a number of managed code Windows Services for which we use the Frameworks InstallUtil tool to install into the service control manager. This tool creates a new file at install time with an extension of .InstallState. I have experimented with deleting this file and an uninstall still works fine afterwards.

So my questions is, what is this file for and is there any reason I shouldn't delete it?

Edit 5/3/10: Really? Nobody has any clue what the value of this file is?

like image 861
BrettRobi Avatar asked Apr 12 '10 19:04

BrettRobi


People also ask

What is Installstate file?

An INSTALLSTATE file is a file created during the installation of a . NET Framework service or application. It contains data used to uninstall an assembly included within the software. INSTALLSTATE files are created by the installutil.exe program.

What is the use of installutil exe?

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. Except for /u and /AssemblyName , options are cumulative but overridable.

What is Windows service installer?

The Windows Installer is an operating system service that was developed by Microsoft to improve the installation and uninstallation of programs, make software deployment in corporate networks easier, and to solve common problems such as shared dll conflicts.

How to add service installer in Windows service?

In Solution Explorer, access Design view for the service for which you want to add an installation component. Click the background of the designer to select the service itself, rather than any of its contents. With the designer in focus, right-click, and then click Add Installer.


2 Answers

In VS.NET you can define a custom dialog for your msi project, I am using such a dialog to ask for the SQL Server address and credentials, the msi stores all the info from the textboxes into InstallState file. When the service is uninstalled it will read the values from InstallState file and will drop the database created in the install phase. In my case InstallState file is a must because the uninstall will fail if the file was deleted after install.

like image 83
Stefan P. Avatar answered Oct 01 '22 09:10

Stefan P.


The InstallState file is used by InstallUtil.exe for uninstalling the service/assembly. The data contained within it is uninstall data only. If you haven't read the short obscure reference on MSDN, you can read it here.

Maybe a setup package uninstalls everything for you correctly but I'm not sure if a service would uninstall properly if you were calling InstallUtil by hand/script yourself.

That's the supposed value of a .InstallState file.

like image 39
Jeff LaFay Avatar answered Oct 01 '22 10:10

Jeff LaFay