cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
roger_hurst
Level 5

need more info on Custom Actions

I'm creating a basic MSI project. After my components are installed on the target machine, some of installed data must be integrated into installed packages already there, using an action I hope is equivalent to OnFirstUIAfter (in installscript projects). I've read KB artical Q112168 (creating and scheduling IS Custom actions ....), and accordingly (I think) defined my action using the CA wizard as: Run InstallScript code, specified function for Source, Synchronous (Ignores exit code), Deferred Execution in System Context, and After Register Type Libraries (Install Execute Sequence).

I've tried other approaches as well, but have not been successful getting into my code.

I'm pretty new to InstallShield, and would really appreciate some help with this. Thanks.
Labels (1)
0 Kudos
(7) Replies
RobertDickau
Flexera Alumni

Is it that your code isn't being called, or that it's being called but not behaving how you want? The scheduling (deferred mode, somewhere after InstallFiles) sounds right...
0 Kudos
roger_hurst
Level 5

Thanks very much for your response.

I put a messagebox at the top.

I saw a thread yesterday describing something similar to what I am trying: "LaunchAppAndWait" of msiexec to effect a child installation. So I tried their approach with child product installation condition: "NOT Installed and NOT PATCH" placed "After ExecuteAction" in User Interface Sequence. When I tried that the install displayed "Error 2762.Cannot write script record. Transaction not started." This occurred after "Copy Files".

For "Return processing" I used "Synchronous (Ignores exit code)" and for "In-Script Execution" I used "Deferred Execution in System Context".

Also, while I have your ear, this person was having trouble getting his uninstall CA to work, and there was no resolution stated. He used: uninstallation condition: "REMOVE="ALL" OR MaintenanceMode="Remove". I'll need help on that as well.

Again, thanks very much.
0 Kudos
RobertDickau
Flexera Alumni

Oh---deferred execution works only in the Execute sequence between InstallInitialize and -Finalize. What sort of change are you trying to make to the other installed package? Running msiexec.exe from the UI sequence can be problematic---the operation will be skipped if the user runs the installation silently, for example.

In what way is that condition not working?
0 Kudos
roger_hurst
Level 5

I'm getting there now -- using the Return processing "Synchronous (Ignores exit code)", In-script execution "Deferred execution in system context", and in Exec sequence "after Register TypeLibraries" on condition "Not Installed AND NOT PATCH".

Small problem now, I had assumed INSTALLDIR would be a known property at this point, but is null. Is INSTALLDIR value available at that point?
0 Kudos
roger_hurst
Level 5

Getting the value of INSTALLDIR in my "Deferred Execution in System Context" CA is becoming a real pain. I've tried suggestions that I've read in your Forum:
1. Moving the CA up in the Sequence: I moved in up to After WriteRegistryValues from After RegisterTypeLibraries.
2. Tried following code:
nvSize = 256;
szInstallDir = "";
nvResult = MsiGetProperty( hMSI, "INSTALLDIR", szInstallDir, nvSize );
if nvResult = ERROR_SUCCESS then
MessageBox( "[INSTALLDIR] = '" + szInstallDir + "'", INFORMATION);
else
MessageBox( "Could not retrieve value of [INSTALLDIR] !!", WARNING);
endif;

On return from MsiGetProperty, nvResult is ERROR_SUCCESS, but szInstallDir is Null.
3. Also tried appending INSTALLDIR as ";INSTALLDIR" in property SecureCustomProperties in the Property Mgr.
Please provide some good info on how to set this.
Best Regards.
0 Kudos
RobertDickau
Flexera Alumni

Please search the docs and these forums for "CustomActionData" (as in the help topic "Accessing or Setting Windows Installer Properties Through Deferred, Commit, and Rollback Custom Actions"), which is necessary to get the value of most properties during deferred execution.
0 Kudos
roger_hurst
Level 5

Now able to see the INSTALLDIR property in the custom action.

The Custom Action executes msiexec to perform a SQL Instance installation. This doesn't work because msiexec is single threaded.
Instead of this, I can apparently use Prerequisite Editor to open MSDE 2000 SP3a.prg. The matching redistributable needs to be downloaded, and when I tried, only Helper.exe downloaded, the other 3 failed. Couple questions:
1. any ideas why the download would fail?
2. assuming download success (eventually), pls give more info about "Application to run" in prereq editor: is the app what creates the SQL Instance?

BTW: I have IS 2009 (V15). Is SQL 2000 compatible with this version?
We are installing a component to SW platform that cannot yet depend on SQL 2005.
0 Kudos