Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Uninstalling existing  product during an installation


31 replies to this topic

bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 22 October 2001 - 10:03


Hi all
I wondered if anyone could give me advice on how I would create a custom action which detects  which version of my product is installed and uninstalls it before installing the newer version.

At the minute I am doing an upgrade which goes over the previously installed version, but  I would prefer to uninstall whatever is on the computer before installing the new product.

Thanks for any replies
Berni


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 22 October 2001 - 10:43

Only you know the signatures of your own software.

An older installation would probably created a registry  key

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\YourNameOrGUID
There will normally be a value "UninstallString" this value is a command line to invoke the uninstall for the older product.

I can easily check that I am upgrading over the top of a pre-windows installer version by detecting some known registry keys to confirm the presence of my software.  If the previous installaion was by msi, It will also be detected by FindExistingProducts and the upgrade table.  So if I find my product and msi does not I know I am upgrading a legacy installation and can take appropriate action.


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 22 October 2001 - 11:40

Hello again Ian

Thanks for your help.

My registry key does not have an UninstallString value, I use the key given to me by the developers and it holds all the default values for the products but thats it.
Could I add this UninstallString value?

I know that there is a command msiexec.exe /x (product code) from the command line that uninstalls my previous version, is there any way I can do this in an installation?

Thanks a million for your help
Berni


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 22 October 2001 - 12:27

Sorry I assumed you wanted to remove a pre- msi installation.

As it is a msi you want to remove during upgrade I suggest you use a major upgrade but include the RemoveExistingProducts action early in the execute sequence, just after InstallValidate is the earliest you may put it.


Alteranatley populating the upgrade table will find any earlier versions for  you.  Your ActionProperty will contain the product code of the old version.  You may then construct a CA type 50 and execute it  (In the user sequence)


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 22 October 2001 - 14:09

Thanks again for all your help Ian!!

bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 24 October 2001 - 09:37

Hi Ian
Sorry to be annoying but how do I access the action property?
do I then put as an argument for my CA
"/x {actionproperty}??
Sorry if this sounds like a stupid question
thanks for any help
Berni


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 24 October 2001 - 11:35

The action property is a name you choose.  It is defined in the last column of the Upgrade Table.  It should be all capitals and must be added to the SecureCustomProperties List.   It should be valid after the FindExistingProducts action.  The attributes column of the Upgrade table should be based on 2 (detect only).


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 25 October 2001 - 17:36

Hi Ian,
I am still having problems with the uninstall of the installed version of my software.

I have Remove existing Products early in the sequence

I also have executed my custom action in the user sequence after AppSearch.

In my Upgrade table i have an entry with
Upgrade Code:123456789
Version Min: 2.10.0000
Attributes: 2
ActionProperty: NEWERVERSIONS (from another of your suggestions!)

In my custom action
Type:50
Source:Msiexec_ Location (which is a value in the property table  c:\winnt\system32\msiexec.exe - the location of msiexec.exe on the client)
Target:msiexec.exe /x {NEWERVERSIONS}

I have  added this CA on the User sequence after AppSearch, however it doesnt seem to meet it in the sequence and all I get is the dialog MaintenanceWelcome which then continues on with the setup.
Am I doing something drastically wrong???
Thanks for any feedback - I really appreciate it
Berni


Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 26 October 2001 - 02:10

Did you change the package code when you built your new msi?

Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 26 October 2001 - 08:53

You need to change the
Product code
Package code
Version number


I assume 123456789 was just a place holder.  It should be a guid.  A copy of the one ISWI keeps in General Information -> Product Properties -> Upgrade Code
.


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 26 October 2001 - 09:12

HI Guys
Thanks for the tips - I changed the product and  package code and the version number and it encountered my CA.

However I am getting an Internal error 2744 c:\winnt\system32\msiexec.exe /x {NEWERVERSIONS}

I think it might be that it is not getting the product code as I get a message saying "Are you sure you want to uninstall this .." then this message "This installation package could not be opened. Verify that the package exists and that you have access to it ..."

And then the internal error 2744 appears.

Do you know what I am doing wrong?

Thanks for any replies,
berni

(Edited by bernadettefearon at 9:39 am on Oct. 26, 2001)


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 26 October 2001 - 09:37

Curly brackets???  You want square ones.

2743 Could not execute custom action [2], location: [3], command: [4]

What does the log say?   And what is the value of the NEWERVERSIONS?



bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 26 October 2001 - 09:54

HI Ian -
My error is now 2744  -
I changed to square brackets and the message is now "Internal Error 2744, c\winnt\system32\msiexec /x "

NEWERVERSIONS is from the Actionproperty in my upgrade table. Is this not my product code?

My Log has this entry for the CA
Action start 09:53:41: Uninstall_Existing.
MSI © (F4:0C): Note: 1: 2744 2: Uninstall_Existing 3: C:\WINNT\system32\msiexec.exe 4: /x  
Internal Error 2835. ErrorIcon, SetupError
Internal Error 2744. Uninstall_Existing, C:\WINNT\system32\msiexec.exe, /x
MSI © (F4:0C): Product: Easyminer 2.1 -- Internal Error 2744. Uninstall_Existing, C:\WINNT\system32\msiexec.exe, /x

Thanks for any help Ian
Berni


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 26 October 2001 - 10:48

You Upgrade table only finds products that are newer than 2.10.0000.  If you want to find any version remove the MinVersion entry from the upgrade table.


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 26 October 2001 - 12:50

Thanks Ian - I got it working  - woohoo!!

bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 29 October 2001 - 11:54

Hi ian
unfortunately my success was shortlived,  - could i ask a question?

This uninstallation of a previously installed product works fine the first time  - but then if i uninstall the product and run the same installation, I get a error 2744 .

Similarily if I rerun the installation package to modify/remove it , I get the same error.

Is there a condition to put on the CA to prevent this ? Or have I done something else wrong?
Thanks for any advice - sorry to be such a nuisance!
Berni


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 30 October 2001 - 11:15

Not Installed

bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 08 November 2001 - 16:57

Hi All

I was wondering about  my property Msiexec_ Location,

At the minute I have a hard coded address, C:\winnt\system32\msiexic.exe.

I am aware that this should not be hard coded as some clients will not have msiexec.exe in this location.

I have tried putting it as [INSTALLDIR]\misc (which is where i have installed it in the installation). However this gives me "Internal Error 2743, DialogName, msiexec.exe, /x {Product Code}.  
Can anyone provide guidance on this?

Also this installation in which I have the CA to remove any installed products, I cannot install it on a clean machine with out an error. Is that normal, does there have to be a clean installation and an upgrade installation??
Thanks for any replies
Berni


Irina

Irina
  • Members
  • 227 posts

Posted 09 November 2001 - 14:58

Hi,
You can use AppSearch from Power Editor to find msiexec.exe before do anything.

Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 09 November 2001 - 15:31

Why look for msiexec.

Perhaps you can simply cal MsiInstallProduct from a custom action.


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 09 November 2001 - 16:38

Hi
I have never used any of the functions Installshield provides. From the help MsiInstallProduct sounds like it would do the trick though.

Where do I define the function? How do you use it?
I am afraid the learning curve never really stops in this game!!
Thanks
Berni


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 09 November 2001 - 17:19

MsiInstallProduct has nothing to do with InstallShield it is part of  windows installer.

For a C(++) custom action you include "msi.h" and link with msi.lib

I believe you have written VBScript actions but as I have mentioned before I am not clear on VB issues. So I can not give useful advice.  The function can be called from VBScript.



Gerstl

Gerstl
  • Members
  • 22 posts

Posted 20 November 2001 - 18:05

Hello,

it seems that you found out a solution to uninstall an older product, before installing the new product.

I tried to manage it just with the tips out of this forum. I'am not getting to a result.

Can someone just wright the necessary steps down for me ?

An additional problem I encounter is that I'am using the ISWI 2.03 German edition, where all is called a litle bit different.

Thank you very much for your help

Jochen Gerstl


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 21 November 2001 - 10:03

Hi Jochen,
I hope I can answer your query.
I didnt get any training in Installshield so what i have been able to grasp has been mainly through this forum too!

I put this question in as I wanted, like you to uninstall my product before I installeda new one. However, I found since I posted this question that Installshield will do this for you automatically and i have since been using that  method.

However, here is how I did the CA that uninstalled (with a lot of help from Installsite!)

In the property manager
MSIEXEC_LOCATION (holding the location of msiexec.exe
SecureCustomProperties - CHECKPRODUCTCODE

In the Upgrade table, I had
Upgrade Code: myupgradecode
VersionMax: 12.00.0000
Attributes:2
ActionProperty:CHECKPRODUCTCODE


CA: Type 50, with a source MSIEXEC_LOCATION, and a target /x [CHECKPRODUCTCODE]

I placed the CA in the sequence after AppSearch with a condition Not Installed.
I also included a dialog before it asking the user if they are sure they want to uninstall with the same condition.

However, I do not use this CA any more, I change the package code, product code and product version of my installation, and Installshield performs this for me.

I am sorry I do not know if it is different in the German edition as I am in Ireland!
I hope that helps you

Berni

(Edited by bernadettefearon at 2:59 pm on Nov. 21, 2001)


Gerstl

Gerstl
  • Members
  • 22 posts

Posted 21 November 2001 - 14:59

I got it work last night.

The problem was my custom action type 50

What still is not working is the entry in SecureCustomProperties

The variable never has a value. (not at runtime and not in the MSI-Debugger)

So the call /x [NEWERVERSIONS]  (I used ) never gets resolved.

When I read your answer correctly then you have nothing entered in the UpgradeTable  under UpgradeCode. I allways did enter here my old Product Code.

I will try the SecureCustomProperties next week. (I hope that I do not have to find a German translation for it)

What is the package Code for ? I have never entered there a Guid. The automatic Option I have turned off.


Thank You very much so far

Jochen Gerstl


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 21 November 2001 - 15:57

Hi!

In the property table you should have a property named SecureCustomProperties with a value NEWERVERSIONS; CHECKPRODUCTCODE.(or whatever you want to call it)

In Upgrade table, i do have something entered in Upgrade code, this is the upgrade property (from General Information - Product Properties) which shouldnt change from release to release.

The package code is a GUID identifying a particular Microsoft  Windows  Installer package. The package code associates an .msi file with a application or product and can also be used for the verification of sources.

Hope this helps you
berni


Gerstl

Gerstl
  • Members
  • 22 posts

Posted 27 November 2001 - 10:46

Hello,

I'm active again.

I'm very confused now.
I tried again to get an value into the variable NEWERVERSIONS I have all enterd like you tould me. But it does not work.

Thereby I found out that, when I delete the entry in the upgrade table and the SecureCustomProperties my CustomAction Type 50 will also work.

For what the #### we need the entries in the upgrade table ?

When the CustomAction is called (just after AppSearch in the UserSequence) there is coming up a popup Windows asking me if I wish to uninstall Yes or No.
How can I avoid this popup Window ?
Or how can I bring the popup window to tell what will be uninstalled ?

Thank you for help so far

Jochen Gerstl


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 27 November 2001 - 11:00

Hi Gerstl,

I am not sure if you can avoid the popup window "Are you sure you want to uninstall?"
I dealt with this by having a dialog put in after Appsearch with the condition"Not Installed" which said "This installation has detected that you already have a version installed. This will now be uninstalled". You can have a Ok and Cancel button on this dialog, and if the user chooses OK , you can set of your CA.

(However if you do  a major upgrade by changing the product code, version and package code, Installshield will uninstall the older version and reinstall the new version without messages)

You should check out the Windows Installer Programmers Reference for all the information on why the Upgrade table is important.
I hope this has been of some help to you
good luck!
Berni


Gerstl

Gerstl
  • Members
  • 22 posts

Posted 27 November 2001 - 12:12

Hi Bernadette,

Your

(However if you do  a major upgrade by changing the product code, version and package code, Installshield will uninstall the older version and reinstall the new version without messages)

sounds like the solution I'm searching for.

But however. If change all the codes my Programm becoms installed without any problems, but the old product keeps installed and working.

In the ControlPanel Software my product will be installed twice. If I uninstall both products the oldest products software keeps installed.

The setup works with or without an entry in the upgrade table in the same way.

I have entered now nearly every where Guidnumbers.

This way should work but does not work .

So it seems to me that I'm doing some very little thing completely wrong.

So what am I doing.

I opened a new project with th wizzard. I chosed to install one component (notepad)
I made a release out of it. And save the project.

I made a copy of the ism-File.
In the copy I change the component from Notepad to Wordpad
I changed the Product Version (from 1.00.0000 to 2.00.0000)
I changed the product- and the upgrade code
I entered a Guid for the packagecode under Releases.Productconfiguration1 (in the original setup there is no packagecode)
I build the new release.
Started the release by calling the setup.exe and I get the product installed twice under the same name.
If I uninstall both products allways one exe keeps left (wordpad or notepad).
But if I understand you correctly then the notepad.exe should become uninstalled during the installation from the new product wordpad. This never occurs both exe remaind on the disk.

So what am I doing wrong ?

If I do not change the Codes then I will become asked to modify, repair or uninstall the product. Afterwards it will then become installed perfectly.

I hope you can help me.

May be you have a small project where you have tested the feature to show me.

Jochen Gerstl


bernadettefearon

bernadettefearon
  • Members
  • 94 posts

Posted 27 November 2001 - 13:20

Hi Gerstl
First thing -
you shouldnt chacge the Upgrade code for the same product ever. This stays the same for the same product.

The version, product code and package code can be changed by going to Organise your setup- Generalinformatio- then summary information stream (for package code) and Windows 2000 (for version and product code). You dont have to change these in notepad or wordpad.

When you change these three values, making sure that the upgrade code is the same throughout for every release, and install over an older version, during the installation, you should see messages appearing like Removing Files, Deleting registry values, etc before  the installation puts on the new  stuff.

you should take a look at "Component, package, product and upgrade codes in Windows Installer" and "Upgrading Without Patching" in the tools and tips section of this forum.

These will step through the whole process for you step by step.
I hope this helps!
Let me know if you get it going!
Berni


Gerstl

Gerstl
  • Members
  • 22 posts

Posted 27 November 2001 - 13:45

Hi

my NEWERVERSION Entry is working now.

My mistake was not to enter the upgrade code. I had, Idon't know why, entered the product code.

They are nearly the same but different.

Jochen



Gerstl

Gerstl
  • Members
  • 22 posts

Posted 28 November 2001 - 12:16

Hi all

the major upgrade is working now as well, without using a custom action. Simply using the upgrade table.

My mistake was to enter  in the Attributes Field a "2" instead of  "1025"

Now it is working !!!!