Reputation: 565
I wonder if someone can assist as I'm tearing my hair out...
System:
VS2010, VS Installer Project, x86 Project, 4 Custom Actions (3 are DLL related and work fine, 1 is to run an embedded EXE (vc_redist.x86.exe) stored within the Binary Table).
Problem:
The embedded EXE fails when it tries to execute.
Description:
So, I have an Installer Project, there are 4 Custom Actions:
3 are to run exported functions from a DLL 1 is to install the VC140 Runtime from the embedded binary stream in the Binary table
The three that are DLL related require the VC140 Runtime to be installed prior to the DLL being called. I realise that I can go down the Pre-Requisite route which generates a setup.exe bootstrap and this works fine, however, I'm limited to having a single .msi file for the time being (we will be updating to a bootstrap later this year when we move to VS2019).
By default the Custom Action to install the VC140 Runtime is created as a Deferred Custom Action and therefore does not run until AFTER the main installation has completed. This is no good, I need it to run quite early in the Installation process.
Therefore in the PostBuildEvent I run a Javascript file via cscript which queries the .msi Database and changes the Deferred Custom Action to a Scheduled Custom Action which I set to sequence 204 - this is BEFORE any installation and BEFORE any calls to my 3 DLL related Custom Actions.
Using Orca I can see the setting for the changed Custom Action is as follows:
Action: _B8A0F1DD_1500_4613_AE6D_9F195588F007 Type: 2 Source: _FDF38A4C9878679D2D80DAA7210C0828 Target: ExtendedType:
The Type (taken from Microsoft's site) is set to 2, this means:
Action Type: EXE file stored in a Binary table stream Type: 2 Source: Key to Binary Table Target: Command-Line string
So, looking at the Binary Table I have a [Binary Data] stream for the Source above (_FDF38A4C9878679D2D80DAA7210C0828).
If I save this Binary Data stream to a file, I can run it no problem and it start the VC Runtime installer, so I know that the Binary Data stream is correct.
When I run the msi installer I get the following Log entry:
*"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 Ended : _B8A0F1DD_1500_4613_AE6D_9F195588F007. Return value 3.*
Looking at the Return value of 3, this is defined as a "Fatal Error" on the Microsoft website.
If I leave the Custom Action as a Deferred Custom Action it runs... but my DLL Custom Actions won't run as they need VC 140.
Questions:
I'm suspicious of the empty Target attribute. It says that this should be a Command-Line string, but is this the case for an embedded EXE? The embedded EXE gets extracted into the C:\windows\installer folder as a .tmp file and the msi executes this as far as I know. Therefore, have the Target empty is correct?
The "Type" field, this is set to 2. There are a myriad of settings for the Type, am I missing something from here?
There is a Impersonate flag, I have tried setting this to both true and false but it doesn't seem to make any difference, what should it be?
Can anyone point me in the direction of a working example of an embedded EXE that runs as a Scheduled Custom Action? I can't find anything online.
Any pointers/assistance is appreciated. Thankyou.
Upvotes: 0
Views: 110