WIX custom action error - wix

I need to execute one DLL during installation of MSI package . The DLL will create a DSN. I added a custom action for that.
<Binary Id="CustomActionBinary" SourceFile="C:\MemDbDrv_3010.dll"/>
<CustomAction Id="CustomActionId" BinaryKey="CustomActionBinary" DllEntry="SelfInstall" Execute="immediate" Return="check" />
<InstallExecuteSequence>
<Custom Action="CustomActionId" Before='InstallFinalize'/>
</InstallExecuteSequence>
It is compiling fine. But while installing the package I am getting the below error
"There is a problem with this Windows installer package.A DLL required for this install to complete could not be run. Contact your support personnel or package vendor"
Can you please help what could be the resolution

Your custom action crashed or didn't load, so you may need to say what language it is and worry about missing dependencies, or even show the code if you don't get anywhere with this. However:
Immediate custom actions run before anything is installed, so if it has any dependent Dlls then they won't yet be installed.
Immediate custom actions shouldn't alter the system because they can't be undone in the event of the install failing. It should be deferred with a rollback to undo it.
It's won't run elevated as immediate, so if it needs privilege to work then it will fail. Deferred CAs run elevated with the system account if they are impersonation=no, so that may be what you need.

Related

Launch Firebird 1.5 installer from WIX

I have been tasked with writing a WIX installer from an application that uses Firebird 1.5. The WIX install process must launch the firebird installer if firebird has not already been installed. Using a custom action I get the firebird installer to launch but end up with error "1607 unable to install installshield scripting runtime". I have searched this error but have not been able to find a resolution.
Here is a snipit of my custom action.
<InstallExecuteSequence>
<Custom Action='LaunchFirebirdsetup' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
<CustomAction Id='LaunchFirebirdsetup' FileKey='Firebird15Setup' ExeCommand='' Return="ignore" Execute="commit" Impersonate="no" />
It might be because you cannot run an MSI install from within an MSI install, I think that's still true even with a Commit custom action. Your IS Script install is an MSI install, so that may be the issue. Launching installs from within installs is always an issue. You should use Burn to launch that Firebird install before installing yours. That's what a Burn bundle is for - prerequsites and associated installs as well as your MSI setup. You could use it to install a standalone ISScript MSI, that's another possibility.
The other issue is that some installs just don't work when installed with no impersonation, which means with the system account. There's no indication that you tried to do it silently, which means that it's running with the system account and may attempt to show UI to the interactive user, and that will fail. This another reason to install it with Burn - it will run as the interactive user.
Looks like bootstrapping (burn) is the solution.
Took me a while to get it but after getting it to run, it makes sense I guess.
Instead of running an installer exe you could use merge modules. For instance the Firebird 1.5 Merge Modules from MWA Software. Modules, installation instruction and source for the merge modules are freely available.

How to stop application automatically before running of uninstallation procedure?

In my installation package I have tool which allows to stop my main application.
I need to run this tool automatically during uninstallation of my application.
I created custom action and start it before or after InstallInitialize.
But it did not help.
Message "The following applications should be closed before continuing the install" still appears.
And script executes only when I click on the button OK in that dialog.
How to start custom action before notification "The following applications should be closed before continuing the install"?
Custom stop action before InstallValidate does not help by some reason.
<InstallExecuteSequence>
<Custom Action='StopApplication' Before="InstallValidate"/>
</InstallExecuteSequence>
<CustomAction Id="StopApplication"
FileKey="stopServer.cmd"
ExeCommand=""
Execute="immediate"
Impersonate="yes"
Return="ignore" />
Detection of apps that need closing down is done by the InstallValidate action, so you need to have your CA before that. After InstallInitialize is too late. That means it needs to be marked immediate.
p.s. WiX has a util CloseApp for this that might work for that app.

MSI Installer: Help running a UI based EXE with a CustomAction from a service based installer

I have created a MSI installer package using Wix Toolset 3.8 that is run by a third party installer service running under the "SYSTEM" account. My issue is that when trying to launch and run an installed executable from my MSI installer using a custom action, it also runs under the SYSTEM account instead of the administrator account that is currently logged in. I have spent hours researching on the net and from what I have read, specifying Impersonate="yes" will run that particular custom action under the account that launched the installer, but there lies the issue. Since the third party installer service is running from the SYSTEM account, specifying Impersonate="yes" would just run the custom action under the SYSTEM account as well correct? At least that's what my tests have shown. A little bit of background on my MSI installer:
InstallScope="perMachine"
<CustomAction Id="StartAction"
Directory="FOLDER"
ExeCommand ='cmd.exe /c start MYEXE.exe /tray'
Execute="immediate"
Impersonate="yes"
Return="check"/>
<InstallExecuteSequence>
<Custom Action='StartAction' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
I have tried both "deferred" and "immediate" for Execute as well as setting "Impersonate" to both yes and no. Is there any way to make this work? I thought about using the runas command but I wouldn't know the password of the user account that initiated the install.
Thanks!
What is the EXE file doing? Do you have control of the application so you can move the logic from that external EXE into the main application's launching logic?
Other than that you can register such an EXE file to run once per user via ActiveSetup. You can also find another answer from me here.
Here is one more link to an explanation of ActiveSetup (I prefer the one above): http://www.ewall.org/tech/msi/self-healing
Also see these answer here: Stopping MSI from launching an EXE in the SYSTEM context

How to get rid of the "files in use" dialog during uninstall?

I'm very new to WIX and am using the minimal GUI to install and uninstall a dll. This dll gets registered as a service in a custom install script that I am calling upon install.
Upon uninstall, I stop and unregister the service in a custom script.
My problem is, before the custom uninstall script is called, I get the files in use dialog box as the dll is being used by the service. I want to avoid this, as I know I will be stopping the service in the custom uninstall action.
Any easy solutions to this problem ?
Thanks!
Nikhil.
Are you using a Custom Action to stop the service? If so I'd make sure that your custom action is run before the removal of your file
i.e.
<CustomAction Id="StopService" Directory="DirMyService" ExeCommand="NET STOP ServiceName" />
<CustomAction Id="StartService" Directory="DirMyService" ExeCommand="NET START ServiceName" />
<InstallExecuteSequence>
<Custom Action="StopService" After="InstallInitialize">Installed</Custom>
<Custom Action="StartService" Before="InstallFinalize">Installed</Custom>
</InstallExecuteSequence>
Haven't tested this, so you may need to stick in the windir before the net stop etc, and those might be the wrong places to put it in to stop/start the scripts. But might give you an idea of how to solve your problem.

WIX MSI customaction not running when deployed using Group Policy

I'm using WIX to create an MSI which has a custom action to install a clickonce application. I want to deploy the MSI via GPO. The custom action runs fine when I just double click to run the msi, but the custom action does not seems to be running when deployed via GPO. But if you look at the add/remove programs in the control panel you have the product/msi listed there as if it was successfully installed.
To see if custom actions work at all when deploying via GPO I created a simple custom action which just writes a file to c:\temp (existing) folder. Added the custom action to both InstallExecuteSequence and AdminExecuteSequence in before installfinalize step. Tried both deffered execute and immediate execute. It works when you double click the msi to install but not via GPO.
Is it possible to have custom actions when the msi is deployed through GPO? Are there any limitations? Is there anything special that I need to do to get it to work with GPO?
Thanks in advance!
Rukshan
I figured it out. The issue was that I hadn't configured the GPO to install the package when the user logs in. After checking that check box in the group policy properties it works.
If you assign the software to users and do not check "install this application at logon", the application will be listed on the user's add/remove programs panel but doesn't really install it. So I was under the impression that it was successfully installed without running the custom action when it really wasn't installed.
Now I have my custom action listed under Install Execute sequence
<InstallExecuteSequence>
<Custom Before='InstallFinalize' Action='ClickOnceIntallCustomAction' >NOT REMOVE</Custom>
</InstallExecuteSequence>
And it is set to execute immediately and check on return
<CustomAction Id="ClickOnceIntallCustomAction" BinaryKey="ClickOnceInstallBinary" Return="check" Execute="immediate" DllEntry="Test" ></CustomAction>