Page 1 of 1

removing the old version fails

Posted: Fri Feb 13, 2009 9:26 am
by ulrichard
Hi everybody,

The installer for my new version fails to uninstall the older version of the same product. This used to work with older versions.

Code: Select all

   if Variable NEEDSUPGRADE Equals TRUE
     Set Variable REMOVEOLD to 
     Set Variable ERROROLD to 
     Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
     if Variable REMOVEOLD Equals ERROR
       MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
       Terminate Installation
     end
$ERROROLD$ says "Dieser Vorgang ist nur für Produkte gültig, die zurzeit installiert sind."
According to http://support.microsoft.com/kb/229683/de that's the MSI errorcode ERROR_UNKNOWN_PRODUCT 1605

So the first guess was, that I changed the product guid by accident.
But Subversion tells me that the product guid is the same for all revisions that I compared.

Further interesting behavior is:
- The second time I start the new installer, it doesn't attempt to remove the old version, and the install succeeds.
- If I install the old version on top of the new one, it correctly removes the new version (another indication that the guid's match).

Has anybody experienced something similar?
Any hints on where to search further?

Rgds
Richard

Posted: Fri Feb 13, 2009 9:58 am
by ulrichard
I found an unusual usage for the errorcode ERROR_UNKNOWN_PRODUCT
at http://msdn.microsoft.com/en-us/library/aa370395.aspx
If the user name is an empty string or NULL, the function operates on the per-machine installation of the product. In this case, if the product is installed only in the per-user state, the function returns ERROR_UNKNOWN_PRODUCT.

If the user name is not an empty string or NULL, it specifies the name of the user whose product installation is modified. If the user name is the current user name, the function first attempts to modify a non-managed installation of the product. If no non-managed installation of the product can be found, the function then tries to modify a managed per-user installation of the product. If no managed or unmanaged per-user installations of the product can be found, the function returns ERROR_UNKNOWN_PRODUCT, even if the product is installed per-machine.
Though probably irrelevant to my problem, it's still interesting.

All my installations are per user.

Rgds
Richard

Posted: Fri Feb 13, 2009 12:14 pm
by ulrichard
So I enabled verbose logging for the removal of the old version.

In the log in several places I see ALLUSERS=TRUE or ALLUSERS=1

So I added the following in front of the uninstall command :

Code: Select all

     Set Variable ALLUSERS to FALSE
     Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
... didn't help ... also ....

Code: Select all

     Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL ALLUSERS=FALSE] (get result into variable REMOVEOLD)
... didn't fix my problem.
At the moment we only support per user installations of our product. So I have several places in my script where I set ALLUSERS to FALSE, but I couldn't find a single line where it could be set to TRUE.

Reading the log still indicates that ALLUSERS is set to TRUE somewhere.

Am I on the right track at all?

Another interesting read :
http://blogs.msdn.com/cjacks/archive/20 ... vista.aspx

Rgds
Richard

Posted: Fri Feb 13, 2009 1:09 pm
by MichaelNesmith
Need a reproducible test case.

Posted: Mon Feb 16, 2009 10:14 am
by ulrichard
Hi Michael,

I found the problem.
It was my mistake.
I did the following just before the uninstall :

Code: Select all

           Write Registry Key HKLM\\#AppRegistryKey#\\Installer\\UserDatBackupDir, $TARGETDIR$ (permanent)
           Apply Install (get result into variable SUCCESS)
           Apply Uninstall (get result into variable SUCCESS)

changing it to

Code: Select all

           Write Registry Persist Key HKLM\\SOFTWARE\\#AppRegistryKey#\\Installer\\UserDatBackupDir, $TARGETDIR$
fixed the problem.

Sorry for bothering...

Rgds
Richard