Discussion:
How to modify MSI to run an executable file
(too old to reply)
Myung
2006-03-13 14:48:28 UTC
Permalink
Hi, I am trying to edit a msi file using ORCA to run an executable file IF it
exists before start to install a program.

For example, if "c:\program files\Mozilla
Thunderbird\uninstall\uninstall.exe" exists, run that uninstall.exe before
install the new Thunderbird in that directory. Even though it's an ungrade,
REMOVEPREVIOUISVERSIONS does not work because it was not installed from a MSI
file, it was installed from an exe file.

I created a vb script to remove the program if it exists but it does not
work if it embedded in the msi file. It works fine if it run by itself.

Thanks in advance for any advise.
Rage
2006-03-13 15:27:28 UTC
Permalink
Hi!

I would recommend that you use the AppSearch action to find out if the file
exist and set a property. After this you sequence a custom action type 50 or
34 to launch it, with a conditional value so that it only launches if the
file exists.

Please let me know if you need more help with this!

/ Rage
Post by Myung
Hi, I am trying to edit a msi file using ORCA to run an executable file IF it
exists before start to install a program.
For example, if "c:\program files\Mozilla
Thunderbird\uninstall\uninstall.exe" exists, run that uninstall.exe before
install the new Thunderbird in that directory. Even though it's an ungrade,
REMOVEPREVIOUISVERSIONS does not work because it was not installed from a MSI
file, it was installed from an exe file.
I created a vb script to remove the program if it exists but it does not
work if it embedded in the msi file. It works fine if it run by itself.
Thanks in advance for any advise.
Myung
2006-03-13 15:59:30 UTC
Permalink
Rage, thanks for replying. That sounds great. I am not really familiar with
using orca (still learning), so please bear with me.

When I go into AppSearch, I see Property and Signature. Can you give me an
example what can I put in there? (documentation is not much of help..)
Post by Rage
After this you sequence a custom action type 50 or
34 to launch it, with a conditional value so that it only launches if the
file exists.
Can you please guide me through this step, also? Thank you very much.
Myung
Post by Rage
Hi!
I would recommend that you use the AppSearch action to find out if the file
exist and set a property. After this you sequence a custom action type 50 or
34 to launch it, with a conditional value so that it only launches if the
file exists.
Please let me know if you need more help with this!
/ Rage
Rage
2006-03-13 17:01:31 UTC
Permalink
Post by Myung
When I go into AppSearch, I see Property and Signature. Can you give me an
example what can I put in there? (documentation is not much of help..)
Property is the name of the property that you would like get the result in,
for example THUNDERBIRDUNINSTALLEXE. Signature_ is a key into some different
tables in order for you to tell AppSearch what to look for.

You want to search for a file, therefore you must make an entry in the
DrLocator table and the Signature table. The DrLocator entry specifies the
directory in which you want to search and Signature describes the file.

The Signature_ field in AppSearch table, DrLocator and the Signature field
in the Signature table must be identical, for example UninstallSignature.

For the Path field in the DrLocator, I would try setting it to something
like [ProgramFilesFolder]\Mozilla Thunderbird\uninstall and ignore the Parent
and Depth fields.

In the Signature table, I recommend that you set FileName to uninstall.exe
and ignore the other fields.

Now when the AppSearch action runs, it sets the value of the property
THUNDERBIRDUNINSTALLEREXE to c:\program files\mozilla
thunderbird\uninstall\uninstall.exe or similar.
Post by Myung
Post by Rage
After this you sequence a custom action type 50 or
34 to launch it, with a conditional value so that it only launches if the
file exists.
Can you please guide me through this step, also? Thank you very much.
Myung
Create an entry in the CustomAction table. Set the Action field to something
descriptive, such as RunThunderbirdUninstaller. Set the Source field to the
name of the property in the AppSearch table, i.e. THUNDERBIRDUNINSTALLEREXE.
The Target column should be set to the command line.

The type column should be set to 50 + 256 i.e. 306. This will cause the
executable to run immediately when the custom action is run and cause the
installation to fail if the exe file returns something other than 0. The
added 256 is to make it only run once during the installation if it is added
in both the InstallUISequence and InstallExecuteSequence.

Next you enter make the custom action run in the sequence you want, the
easiest may be to add it in both InstallUISequence and InstallExecuteSequence.

For both these tables, create an entry with the Action field set to the name
of the custom action, ie RunThunderbirdUninstaller. The condition should be
set to something like Not Installed And (REMOVE <> ALL) to make it run only
during first installation and not when uninstalling the new installation
package. The sequence number should be set to a number higher than the number
that is used for the AppSearch action, so that the custom action runs after
AppSearch has been done.

That should probably do the trick for you. If not, please let me know and
I'll help you in case I've forgotten something or got something wrong here.

/ Rage
Myung
2006-03-13 18:07:33 UTC
Permalink
This is wonderful. I will try it out this afternoon and update you the
result. Thanks!!!!
Post by Rage
Post by Myung
When I go into AppSearch, I see Property and Signature. Can you give me an
example what can I put in there? (documentation is not much of help..)
Property is the name of the property that you would like get the result in,
for example THUNDERBIRDUNINSTALLEXE. Signature_ is a key into some different
tables in order for you to tell AppSearch what to look for.
You want to search for a file, therefore you must make an entry in the
DrLocator table and the Signature table. The DrLocator entry specifies the
directory in which you want to search and Signature describes the file.
The Signature_ field in AppSearch table, DrLocator and the Signature field
in the Signature table must be identical, for example UninstallSignature.
For the Path field in the DrLocator, I would try setting it to something
like [ProgramFilesFolder]\Mozilla Thunderbird\uninstall and ignore the Parent
and Depth fields.
In the Signature table, I recommend that you set FileName to uninstall.exe
and ignore the other fields.
Now when the AppSearch action runs, it sets the value of the property
THUNDERBIRDUNINSTALLEREXE to c:\program files\mozilla
thunderbird\uninstall\uninstall.exe or similar.
Post by Myung
Post by Rage
After this you sequence a custom action type 50 or
34 to launch it, with a conditional value so that it only launches if the
file exists.
Can you please guide me through this step, also? Thank you very much.
Myung
Create an entry in the CustomAction table. Set the Action field to something
descriptive, such as RunThunderbirdUninstaller. Set the Source field to the
name of the property in the AppSearch table, i.e. THUNDERBIRDUNINSTALLEREXE.
The Target column should be set to the command line.
The type column should be set to 50 + 256 i.e. 306. This will cause the
executable to run immediately when the custom action is run and cause the
installation to fail if the exe file returns something other than 0. The
added 256 is to make it only run once during the installation if it is added
in both the InstallUISequence and InstallExecuteSequence.
Next you enter make the custom action run in the sequence you want, the
easiest may be to add it in both InstallUISequence and InstallExecuteSequence.
For both these tables, create an entry with the Action field set to the name
of the custom action, ie RunThunderbirdUninstaller. The condition should be
set to something like Not Installed And (REMOVE <> ALL) to make it run only
during first installation and not when uninstalling the new installation
package. The sequence number should be set to a number higher than the number
that is used for the AppSearch action, so that the custom action runs after
AppSearch has been done.
That should probably do the trick for you. If not, please let me know and
I'll help you in case I've forgotten something or got something wrong here.
/ Rage
Rage
2006-03-13 18:17:29 UTC
Permalink
Post by Rage
The condition should be
set to something like Not Installed And (REMOVE <> ALL) to make it run only
during first installation and not when uninstalling the new installation
package.
Oupps, make the condition Not Installed And (REMOVE <> "ALL") since you must
have quotes on text... My bad.

/ Rage
Myung
2006-03-13 21:05:27 UTC
Permalink
Rage, I am still having problems with running uninstall using your
suggestion. I know I am doing something dumb. Here is what I did to msi file
usung orca. Can you see what am I doing wrong?

AppSearch:
Property: ThunderbirdUninstaller
Signature: UninstallThunderbird.exe

DrLocator:
Signature: UninstallThunderbird.exe
Parent:
Path: [ProgramFilesFolder]\Mozilla Thunderbird\Uninstall
Depth:

Signature:
Signature: UninstallThunderbird.exe

CustomAction:
Action: RunThunderbirdUninstaller
Type: 306
Source: ThunderbirdUninstaller
Target: uninstallthunderbird.exe /q
??? I am not sure if I understood your comment of "set to command line" for
this Target column.

InstallExecuteSequence:
Action: RunThunderbirdUninstaller
Condition:NOT Installed AND (REMOVE <> ALL)
Sequence: 150 --- (AppSearch is 100)

InstalUISequence
Action: RunThunderbirdUninstaller
Condition:NOT Installed AND (REMOVE <> ALL)
Sequence: 150 --- (AppSearch is 100)

When I ran this MSI file with /l* option, following is first few lines of log:
=== Logging started: 3/13/2006 15:34:55 ===
Action 15:34:55: INSTALL.
Action start 15:34:55: INSTALL.
Action 15:34:55: AppSearch. Searching for installed applications
Action start 15:34:55: AppSearch.
AppSearch: Property: THUNDERBIRDUNINSTALLER, Signature:
UninstallThunderbird.exe
Action ended 15:34:55: AppSearch. Return value 1.
Action 15:34:55: LaunchConditions. Evaluating launch conditions
Action start 15:34:55: LaunchConditions.
Action ended 15:34:55: LaunchConditions. Return value 1.
Action 15:34:55: CCPSearch. Searching for qualifying products
Action start 15:34:55: CCPSearch.
Action ended 15:34:55: CCPSearch. Return value 1.
Action 15:34:55: RMCCPSearch. Searching for qualifying products
Action start 15:34:55: RMCCPSearch.
Action ended 15:34:55: RMCCPSearch. Return value 0.

Thanks!!
Phil Wilson
2006-03-13 21:49:53 UTC
Permalink
Conditions where you compare REMOVE with ALL need to have ALL in quotes -
REMOVE<>"ALL".
--
Phil Wilson [MVP Windows Installer]
----
Post by Myung
Rage, I am still having problems with running uninstall using your
suggestion. I know I am doing something dumb. Here is what I did to msi file
usung orca. Can you see what am I doing wrong?
Property: ThunderbirdUninstaller
Signature: UninstallThunderbird.exe
Signature: UninstallThunderbird.exe
Path: [ProgramFilesFolder]\Mozilla Thunderbird\Uninstall
Signature: UninstallThunderbird.exe
Action: RunThunderbirdUninstaller
Type: 306
Source: ThunderbirdUninstaller
Target: uninstallthunderbird.exe /q
??? I am not sure if I understood your comment of "set to command line" for
this Target column.
Action: RunThunderbirdUninstaller
Condition:NOT Installed AND (REMOVE <> ALL)
Sequence: 150 --- (AppSearch is 100)
InstalUISequence
Action: RunThunderbirdUninstaller
Condition:NOT Installed AND (REMOVE <> ALL)
Sequence: 150 --- (AppSearch is 100)
=== Logging started: 3/13/2006 15:34:55 ===
Action 15:34:55: INSTALL.
Action start 15:34:55: INSTALL.
Action 15:34:55: AppSearch. Searching for installed applications
Action start 15:34:55: AppSearch.
UninstallThunderbird.exe
Action ended 15:34:55: AppSearch. Return value 1.
Action 15:34:55: LaunchConditions. Evaluating launch conditions
Action start 15:34:55: LaunchConditions.
Action ended 15:34:55: LaunchConditions. Return value 1.
Action 15:34:55: CCPSearch. Searching for qualifying products
Action start 15:34:55: CCPSearch.
Action ended 15:34:55: CCPSearch. Return value 1.
Action 15:34:55: RMCCPSearch. Searching for qualifying products
Action start 15:34:55: RMCCPSearch.
Action ended 15:34:55: RMCCPSearch. Return value 0.
Thanks!!
Myung
2006-03-13 21:51:29 UTC
Permalink
I just saw your last post about
condition Not Installed And (REMOVE <> "ALL")

After adding quote, it's WORKING!!!! THANKS!!!!
Post by Myung
Rage, I am still having problems with running uninstall using your
suggestion. I know I am doing something dumb. Here is what I did to msi file
usung orca. Can you see what am I doing wrong?
Property: ThunderbirdUninstaller
Signature: UninstallThunderbird.exe
Signature: UninstallThunderbird.exe
Path: [ProgramFilesFolder]\Mozilla Thunderbird\Uninstall
Signature: UninstallThunderbird.exe
Action: RunThunderbirdUninstaller
Type: 306
Source: ThunderbirdUninstaller
Target: uninstallthunderbird.exe /q
??? I am not sure if I understood your comment of "set to command line" for
this Target column.
Action: RunThunderbirdUninstaller
Condition:NOT Installed AND (REMOVE <> ALL)
Sequence: 150 --- (AppSearch is 100)
InstalUISequence
Action: RunThunderbirdUninstaller
Condition:NOT Installed AND (REMOVE <> ALL)
Sequence: 150 --- (AppSearch is 100)
=== Logging started: 3/13/2006 15:34:55 ===
Action 15:34:55: INSTALL.
Action start 15:34:55: INSTALL.
Action 15:34:55: AppSearch. Searching for installed applications
Action start 15:34:55: AppSearch.
UninstallThunderbird.exe
Action ended 15:34:55: AppSearch. Return value 1.
Action 15:34:55: LaunchConditions. Evaluating launch conditions
Action start 15:34:55: LaunchConditions.
Action ended 15:34:55: LaunchConditions. Return value 1.
Action 15:34:55: CCPSearch. Searching for qualifying products
Action start 15:34:55: CCPSearch.
Action ended 15:34:55: CCPSearch. Return value 1.
Action 15:34:55: RMCCPSearch. Searching for qualifying products
Action start 15:34:55: RMCCPSearch.
Action ended 15:34:55: RMCCPSearch. Return value 0.
Thanks!!
Myung
2006-03-14 19:37:33 UTC
Permalink
Rage, with your help yesterday, I was able to modify my msi file to run
uninstaller and install the newer version. However, I ran into a new problem
today. When I ran this msi on a system has no Thunderbird installed, it seems
still trying to uninstall it first.

It gives following error:
There is a problem with this Windows Installer Package. A program required
for this install to complete could not be run. Contact your support personnel
or package vendor.

Looks like my AppSearch is not being ignored if "c:\Program Files\Mozilla
Thunder Bird\Unstall" directory doesn't exists. Where should I start to
troubleshoot this?

Thanks.
Myung

The following is first few lines of log file:
=== Logging started: 3/14/2006 14:22:06 ===
Action 14:22:06: INSTALL.
Action start 14:22:06: INSTALL.
Action 14:22:06: AppSearch. Searching for installed applications
Action start 14:22:06: AppSearch.
AppSearch: Property: THUNDERBIRDUNINSTALLER, Signature:
UninstallThunderbird.exe
Action ended 14:22:06: AppSearch. Return value 1.
Action 14:22:06: RunThunderbirdUninstaller.
Action start 14:22:06: RunThunderbirdUninstaller.
Info 2898. VSI_MS_Sans_Serif13.0_0_0, MS Sans Serif, 0
DEBUG: Error 2835: The control ErrorIcon was not found on dialog ErrorDialog
The installer has encountered an unexpected error installing this package.
This may indicate a problem with this package. The error code is 2835. The
arguments are: ErrorIcon, ErrorDialog,
Error 1721. There is a problem with this Windows Installer package. A
program required for this install to complete could not be run. Contact your
support personnel or package vendor. Action: RunThunderbirdUninstaller,
location: , command: uninstallthunderbird.exe /q
MSI (c) (C0:30) [14:29:23:673]: Product: Mozilla Thunderbird -- Error 1721.
There is a problem with this Windows Installer package. A program required
for this install to complete could not be run. Contact your support personnel
or package vendor. Action: RunThunderbirdUninstaller, location: , command:
uninstallthunderbird.exe /q

Action ended 14:29:23: RunThunderbirdUninstaller. Return value 3.
Action 14:29:23: FatalErrorForm.
Action start 14:29:23: FatalErrorForm.
Kalle Olavi Niemitalo
2006-03-15 06:07:14 UTC
Permalink
Post by Myung
Rage, with your help yesterday, I was able to modify my msi file to run
uninstaller and install the newer version. However, I ran into a new problem
today. When I ran this msi on a system has no Thunderbird installed, it seems
still trying to uninstall it first.
If the AppSearch action does not find the file (uninstall.exe),
then it leaves the property (THUNDERBIRDUNINSTALLER) unchanged.
If that property is not listed in the Property table, then it is
by default null, i.e. its value is an empty string. So, you
could make the condition check whether the property has been set:

THUNDERBIRDUNINSTALLER And Not Installed And (REMOVE <> "ALL")
Myung
2006-03-15 12:51:27 UTC
Permalink
Thank you, thank you, thank you.
By adding THUNDERBIRDUNINSTALLER And Not Installed And (REMOVE <> "ALL")
into the condition solved the problem.

I would never thought to check that, but by looking back, it does make some
sense.
You guys are GREAT!!!!
Post by Kalle Olavi Niemitalo
Post by Myung
Rage, with your help yesterday, I was able to modify my msi file to run
uninstaller and install the newer version. However, I ran into a new problem
today. When I ran this msi on a system has no Thunderbird installed, it seems
still trying to uninstall it first.
If the AppSearch action does not find the file (uninstall.exe),
then it leaves the property (THUNDERBIRDUNINSTALLER) unchanged.
If that property is not listed in the Property table, then it is
by default null, i.e. its value is an empty string. So, you
THUNDERBIRDUNINSTALLER And Not Installed And (REMOVE <> "ALL")
Continue reading on narkive:
Loading...