This article was going to be about Setup Projects in VB.NET 2005. Unfortunately (or fortunately, depending on your point of view), I burned up all the time I had to develop the article defeating a bug in the install. The article is now about that bug and how I defeated it.
First ... the bug ...
I decided to illustrate the article with VB.NET 2005 programs installed on a Windows 2000 computer over a network. Things were going great until I started experimenting with network connectivity: "Gee! I wonder what would happen if I just pulled the plug on the installation in the middle." You can learn a lot doing things like this. (I did!) But next time I'll pay more attention to where I am with respect to publishing deadlines.
In brief, I ended up with half of an install on the Windows 2000 machine.
The Windows 2000 machine did have some sort of registry setting that prevented the program from simply being reinstalled again. When a new SETUP was executed, an error window was displayed that stated:
Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.
The program had not been installed, so it wasn't listed in Add/Remove Programs!
I couldn't install it and I couldn't remove it either. For a while, I was just stuck!
The answer turned out to be the use of the Windows Installer, msiexec, in command mode. An understanding of the msiexec utility is a valuable addition to your trouble toolkit, especially when things don't work. Here's how I solved my problem.
First, open a command prompt window and navigate to the folder that the Setup.exe and <program name>.msi files for your application are in. msiexec requires the ".msi" file.
The basic syntax of msiexec is as follows:
msiexec /Option <Required Parameter> [Optional Parameter]
A convenient dialog window is displayed that shows you all of the options whenever the syntax you enter is incorrect. Click the link below to see it.
Click Here to display the illustration
Click the Back button on your browser to return
The usual option is to install (the /i parameter is for installing) a system with a command like this (program_name is the name of the .msi file).
msiexec /i program_name
There is also an uninstall option:
msiexec /x program_name
I tried the second one and a dialog informed me that the program wasn't installed and couldn't be uninstalled. Ummmm .... I guess that was true. It was "half installed".
Fortunately, msiexec has options to display more information to help you figure things out. The logging option includes these parameters (and about a dozen others).
v - Verbose output
x - Extra debugging information
+ - Append to existing log file
Using the "log verbose" option (/lv), I created a log file :
msiexec /i program_name /lv mylogfile.log
This failed, of course, but it gave me a clue about where the problem actually was in the registry. The log file told me what the GUID for the application was!
(The GUID, or Globally Unique Identifier, is the key in the registry where program information is saved.
I searched the registry using the REGEDT32 utility for that key and discovered that the registry did contain the actual command, in easy to read text form, that would be used to uninstall the program if it had been listed in Add/Remove Programs.
The command was:
The GUID pointed to the uninstall. I entered this in the Command Prompt window and the application was cheerfully uninstalled! I used the VB.NET generated Setup to install the program (no messing around this time) and it was cheerfully installed completely and flawlessly.
After all this, I decided that this extra dimension in using the Windows Installer would be as useful to About Visual Basic readers as the continuation of the series. A couple of other items that might be of use to you are:
Using the latest version of the Windows Installer is a good idea. If computers need to be updated, you can find version 3.1 by searching MSDN.Microsoft.com for "Windows Installer".
There is also a Windows Installer Cleanup Utility that can help resolve the same kinds of issues.