This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Disable Custom Action in an old MSI on upgrade
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 13, 2008
07:57 AM
Disable Custom Action in an old MSI on upgrade
Hi People,
I have a question about disabling custom actions in the old msi when you are upgrading and the old MSI is uninstalled, my problem is as follows.
1) MSI 1 is installed on the machine which has been written poorly!
2) MSI 2 upgrades MSI 1 properly; this works fine and uses the "Install Setup and remove unneeded files"
3) MSI 1 when it is uninstalled by MSI 2 near the end of the upgrade, it runs a custom action that executes an EXE and I do not want this to happen. I have established that the exe is also the cached version of the exe even though the component was set to run the installed file and NOT from the binary stream (this is not confusing at all!). I thought I could add a fix in the the new exe so skip execution on an upgrade but because of this it does not work.
So basically I want to stop this custom action from running somehow when the old MSI is uninstalled. Can anyone give me some pointers please or is this just not possible?
Thanks,
Delboy
I have a question about disabling custom actions in the old msi when you are upgrading and the old MSI is uninstalled, my problem is as follows.
1) MSI 1 is installed on the machine which has been written poorly!
2) MSI 2 upgrades MSI 1 properly; this works fine and uses the "Install Setup and remove unneeded files"
3) MSI 1 when it is uninstalled by MSI 2 near the end of the upgrade, it runs a custom action that executes an EXE and I do not want this to happen. I have established that the exe is also the cached version of the exe even though the component was set to run the installed file and NOT from the binary stream (this is not confusing at all!). I thought I could add a fix in the the new exe so skip execution on an upgrade but because of this it does not work.
So basically I want to stop this custom action from running somehow when the old MSI is uninstalled. Can anyone give me some pointers please or is this just not possible?
Thanks,
Delboy
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 13, 2008
05:22 PM
I had a similar situation a couple of years ago. We had a setup which was released to many customers which had a flaw preventing it from even uninstalling. Since it wouldn't uninstall, it also could not be updated with a major upgade. I was able to fix it without much impact on the customer. In similar fashion to what I did, you could do was follows:
1. Create an updated package which fixes the problem in the original troubled package, in your case, it will remove the custom action on uninstall that you don't want to run. No other changes are made, other than the one you need, and make it a minor upgrade to the original. The only thing you will want to happen here is for the package to be re-cached without the problem action. I'll refer to this as package "A".
2. Your new version you are trying to install I'll refer to as package "B". This should be a Major upgrade. To this package, add a prerequisite check which looks to see if the problem package in question was installed on the target machine. If it was installed, launch the fix package (package "A" above), passing the parameter of "REINSTALLMODE=v". This tells the Windows Installer to replace the existing (problematic) cache on the target machine.
3. The new version, a major upgrade (package "B"), will now run after the prerequisite is finished. It will preform the normal Major upgrade, removing the existing version by running from cache (your new cache, without the CA), and since the cache is now replaced, the undesirable action does not occur. It simply removes as it should and the new version replaces it.
1. Create an updated package which fixes the problem in the original troubled package, in your case, it will remove the custom action on uninstall that you don't want to run. No other changes are made, other than the one you need, and make it a minor upgrade to the original. The only thing you will want to happen here is for the package to be re-cached without the problem action. I'll refer to this as package "A".
2. Your new version you are trying to install I'll refer to as package "B". This should be a Major upgrade. To this package, add a prerequisite check which looks to see if the problem package in question was installed on the target machine. If it was installed, launch the fix package (package "A" above), passing the parameter of "REINSTALLMODE=v". This tells the Windows Installer to replace the existing (problematic) cache on the target machine.
3. The new version, a major upgrade (package "B"), will now run after the prerequisite is finished. It will preform the normal Major upgrade, removing the existing version by running from cache (your new cache, without the CA), and since the cache is now replaced, the undesirable action does not occur. It simply removes as it should and the new version replaces it.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 21, 2008
11:05 AM
I have similar problem like Delboy - but in my scenario the middle step is not allowed. 😮
I have to disable custom action, that is launched from old package while "RemoveExistingProducts" but I cannot do this: "Create an updated package which fixes the problem in the original troubled package, in your case, it will remove the custom action on uninstall that you don't want to run".
Is there any other way to eliminate unnecessary CA from the old package using the new version?
Thanks in advance,
Marek
I have to disable custom action, that is launched from old package while "RemoveExistingProducts" but I cannot do this: "Create an updated package which fixes the problem in the original troubled package, in your case, it will remove the custom action on uninstall that you don't want to run".
Is there any other way to eliminate unnecessary CA from the old package using the new version?
Thanks in advance,
Marek
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 21, 2008
12:06 PM
Marek,
Unfortunately, if it is a major upgrade, the previous installation will be removed during the upgrade, causing the custom action to run on uninstall.
Does the new build have to be a major upgrade? Can it be a minor upgrade? A minor upgrade could be ran on the target machine with the same command-line parameter as described previously, causing it to recache without the issue in future versions.
On another note, I'm just curious, but why can't you create a prerequisite package to run as described in step 2?
Unfortunately, if it is a major upgrade, the previous installation will be removed during the upgrade, causing the custom action to run on uninstall.
Does the new build have to be a major upgrade? Can it be a minor upgrade? A minor upgrade could be ran on the target machine with the same command-line parameter as described previously, causing it to recache without the issue in future versions.
On another note, I'm just curious, but why can't you create a prerequisite package to run as described in step 2?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 23, 2008
10:31 AM
Thanks for the reply guys it helped me find a solution that I was happy with. I finally resorted to doing the following:
Create a VB script that locates the cached MSI of the previous installation and changes the database so that the old custom action in question is no longer executed.
... And it works perfectly, I have even created a rollback script so that it will still uninstall the old MSI properly if we choose not to upgrade half way through an upgrade.
I have added the script below for people to have a look at and modify for their puropse if required.
Thanks again for the help. 😉
Delboy
'------- begin script ------
Option Explicit
On Error Resume Next
Const msiOpenDatabaseModeTransact = 1
Dim sDisplayName, installer, sVersionMajorNumber , sProductCode, sProductName, sMyProdCode, sMsiCache
Dim sQuery, query, view, databasePath, database, openMode
openMode = msiOpenDatabaseModeTransact
Set installer = CreateObject("WindowsInstaller.Installer")
For Each sProductCode In installer.Products
'MsgBox sProductCode,64,"ProductCode"
sDisplayName = installer.productInfo(sProductCode, "ProductName")
'MsgBox sDisplayName,64,"ProductName"
sVersionMajorNumber = Installer.productInfo(sProductCode, "VersionMajor")
If sVersionMajorNumber = 4 And (sDisplayName = "MyProduct") Then
sMsiCache = installer.productInfo(sProductCode, "LocalPackage")
'MsgBox sVersionNumber ,64,"Version"
'MsgBox sMsiCache,64,"MsiCacheName"
Exit For
End If
Next
' Modify condition of the 'U10_UnregService' to stop it running
databasePath = sMsiCache
sQuery = "UPDATE InstallExecuteSequence SET Condition='0' WHERE Action='U10_UnregService'"
Set database = installer.OpenDatabase(databasePath, openMode)
Set view = database.OpenView(sQuery)
view.Execute
database.Commit
wscript.quit
'------- end script --------
Create a VB script that locates the cached MSI of the previous installation and changes the database so that the old custom action in question is no longer executed.
... And it works perfectly, I have even created a rollback script so that it will still uninstall the old MSI properly if we choose not to upgrade half way through an upgrade.
I have added the script below for people to have a look at and modify for their puropse if required.
Thanks again for the help. 😉
Delboy
'------- begin script ------
Option Explicit
On Error Resume Next
Const msiOpenDatabaseModeTransact = 1
Dim sDisplayName, installer, sVersionMajorNumber , sProductCode, sProductName, sMyProdCode, sMsiCache
Dim sQuery, query, view, databasePath, database, openMode
openMode = msiOpenDatabaseModeTransact
Set installer = CreateObject("WindowsInstaller.Installer")
For Each sProductCode In installer.Products
'MsgBox sProductCode,64,"ProductCode"
sDisplayName = installer.productInfo(sProductCode, "ProductName")
'MsgBox sDisplayName,64,"ProductName"
sVersionMajorNumber = Installer.productInfo(sProductCode, "VersionMajor")
If sVersionMajorNumber = 4 And (sDisplayName = "MyProduct") Then
sMsiCache = installer.productInfo(sProductCode, "LocalPackage")
'MsgBox sVersionNumber ,64,"Version"
'MsgBox sMsiCache,64,"MsiCacheName"
Exit For
End If
Next
' Modify condition of the 'U10_UnregService' to stop it running
databasePath = sMsiCache
sQuery = "UPDATE InstallExecuteSequence SET Condition='0' WHERE Action='U10_UnregService'"
Set database = installer.OpenDatabase(databasePath, openMode)
Set view = database.OpenView(sQuery)
view.Execute
database.Commit
wscript.quit
'------- end script --------
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 23, 2008
12:13 PM
Delboy,
Great job!
The line:
sMsiCache = installer.productInfo(sProductCode, "LocalPackage")
is that what I need, and works perfect...:)
With kindest regards,
Marek
Great job!
The line:
sMsiCache = installer.productInfo(sProductCode, "LocalPackage")
is that what I need, and works perfect...:)
With kindest regards,
Marek