WIX Custom Action is not Executing during Upgrade - wix

I am unable to execute custom action during Upgrade.It is giving the following error in logs.
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: CA_DFADMINWSPUPGRADE, location: E:\DealFoundrySetUp\, command: "E:\DealFoundrySetUp\PSScripts\UpdateAminWSP.bat" "Admin.wsp" "E:\DealFoundrySetUp\DFAdmin\AdminWsp\Admin.wsp"
MSI (s) (74:B4) [17:03:11:416]: Product: DealFoundry -- 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: CA_DFADMINWSPUPGRADE, location: E:\DealFoundrySetUp\, command: "E:\DealFoundrySetUp\PSScripts\UpdateAminWSP.bat" "Admin.wsp" "E:\DealFoundrySetUp\DFAdmin\AdminWsp\Admin.wsp"
<CustomAction Id="CA_DFADMINWSPUPGRADE" Impersonate="no"
ExeCommand='"[INSTALLDIR_UG]PSScripts\UpdateAminWSP.bat" "[PRO_ADMINWSPNAME_UG]" "[PRO_ADMINWSPPATH_UG]"'
Directory="INSTALLDIR" Execute="deferred" Return="check" />
INSTALLDIR_UG value i am saving in Registry and during installation and using while Upgrade
<Property Id="INSTALLDIR_UG">
<RegistrySearch Id="rsDFInstallDirectory"
Name="DFInstallDirectory"
Root="HKLM"
Key="SOFTWARE\VALUEMOMENTUM\DEALFOUNDRY\DealFoundryAdmin"
Type="raw"
Win64="yes">
</RegistrySearch>
</InstallExecuteSequence>
<Custom Action="CA_DFADMINWSPUPGRADE" After="InstallFiles">
<![CDATA[INSTALL_DFUSERMANAGEMENT=1 AND (OLDER_VERSION_FOUND)]]>
</Custom>
</InstallExecuteSequence>
Any one help me plz.

Try switching to Impersonate="yes" i think your script might not execute as Local System.

Related

WiX Toolset - issues running cmd in Custom Action

I'm trying to add a custom action that will delete files from the installation folder using the following code:
<CustomAction Id="InstallService" Return="check" Impersonate="no" Execute="deferred" Directory="INSTALLFOLDER" ExeCommand='cmd.exe /C del /s /q "[INSTALLFOLDER]"'/>
<InstallExecuteSequence>
<Custom Action="InstallService" Before ="InstallFiles">NOT Installed AND NOT REMOVE</Custom>
</InstallExecuteSequence>
This works on some computers but fails on others showing a message
A program required for install to complete could not be run.
And in the installation logs I see
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
Any idea why this might happen or how to make it work?

How do you install VS Tools For Office Runtime from my WiX installer? I'm getting "waiting for another install to complete" deadlock

I'm writing an installer for my Office Outlook add-in using WiX. The add-in itself requires VS Tools For Office Runtime to be installed. So I thought to install it as a custom-action from within my own WiX installer:
<Binary Id='idBinVstorRedist' SourceFile='Sources\vstor_redist.exe' />
<CustomAction Id="idCSVstorRedist" Return="asyncWait" HideTarget="no" Execute="deferred" Impersonate="no" ExeCommand="" BinaryKey="idBinVstorRedist" />
<InstallExecuteSequence>
<Custom Action="idCSVstorRedist" After="InstallInitialize">
NOT Installed
</Custom>
</InstallExecuteSequence>
where the vstor_redist.exe itself is part of my MSI package:
But when I run my installer it deadlocks in the VstorRedist with the message: "Waiting for another install to complete":
What am I doing wrong here?
To check whether the VSTO Office Runtime is installed, we’ll add condition and two RegistrySearch elements. RegistrySearch, does exactly what the name implies, it searches the target machines’ registry for a specific key and value.
<Property Id="VSTORUNTIMEREDIST">
<RegistrySearch
Id="VSTORuntimeRedist"
Root="HKLM"
Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R"
Name="Version"
Type="raw" />
</Property>
<Condition
Message="The Visual Studio 2010 Tools for Office Runtime is not installed.
Please download and install from
http://www.microsoft.com/en-us/download/details.aspx?id=20479.">
<![CDATA[Installed OR VSTORUNTIMEREDIST>="10.0.30319"]]>
</Condition>
Read more about that in the Creating WiX installation projects for VSTO-based Office add-ins article.
Also, you may find the How do you use WiX to deploy VSTO 3.0 addins? article helpful.
It may be due to the fact that your custom action is set to run After="InstallInitialize". I'm trialing running a batch script to install the runtime after checking if it isn't present or not and it appears to be working okay for me like this
<InstallExecuteSequence>
<Custom Action="RunBatch" Before="InstallFinalize"/>
</InstallExecuteSequence>
<CustomAction Id="RunBatch"
Execute="deferred"
Return="ignore"
Impersonate="no"
ExeCommand=""[SystemFolder]cmd.exe" /C "[INSTALLFOLDER]vsto_runtime.bat""
Directory="INSTALLFOLDER"/>
This is not the recommended way to install prerequisites but after having issues with creating a bundle, this is a working short term fix for me
Hopefully this is of some use for you.

Cannot run default browser from WIX installation

From tutorial:
<Property Id="BROWSER">
<RegistrySearch Id='DefaultBrowser' Type='raw' Root='HKCR' Key='http\shell\open\command' />
</Property>
<CustomAction Id='LaunchBrowser' Property='BROWSER' ExeCommand='www.something.com' Return='asyncNoWait' />
<InstallExecuteSequence>
...
<Custom Action='LaunchBrowser' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
As I can see from installation traces, property BROWSER is calculated correctly:
Property(S): BROWSER = "C:\Program Files (x86)\Internet
Explorer\iexplore.exe" -nohome
But browser is not open after installation.
MSI (s) (88:90) [18:38:30:331]: Doing action: LaunchBrowser MSI (s)
(88:90) [18:38:30:331]: Note: 1: 2205 2: 3: ActionText Action start
18:38:30: LaunchBrowser. Action ended 18:38:30: INSTALL. Return value
1. Action ended 18:38:30: LaunchBrowser. Return value 1631.
...
MSI (c) (64:6C) [18:38:30:409]: Product: WebPrintingService -- Installation completed successfully.
What could be wrong?
Windows 7.
UAC - default.
UPDATE:
As a workaround it is possible to use following code(but I am not sure that it is a good workaround):
<Property Id="BROWSER">
<RegistrySearch Id='DefaultBrowser' Type='raw' Root='HKCR' Key='http\shell\open\command' />
</Property>
<CustomAction Id="LaunchBrowser" Directory="INSTALLDIR" Impersonate="no" Execute="deferred" ExeCommand='[BROWSER] "test.html"' Return="check"/>
<InstallExecuteSequence>
<Custom Action='LaunchBrowser' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
I have not made an installer that can run the default browser after installtion but I have made an installer with WiX that launches the installed application. As far as I know, the ExeCommand property must contain the file path to an executable file. It can be either the path on your computer directly or a string property you defined containing the file path. Maybe you can tell the program wich file it should open, wich would be in your case a website.
I hope this helps.

Elevated custom action before removing files

I'm trying to write an Installer for my Windows Service using WiX. My executable can register/unregister itself as a Windows Service using the command line parameters --install and --uninstall. This is what I came up with:
<CustomAction Id='InstallAsService' FileKey='CCWirelessServer.exe' ExeCommand='--install' Return='check' Impersonate='no' Execute='deferred' />
<CustomAction Id='InstallAsServiceRollback' FileKey='CCWirelessServer.exe' ExeCommand='--uninstall' Return='check' Impersonate='no' Execute='rollback' />
<CustomAction Id='UninstallAsService' FileKey='CCWirelessServer.exe' ExeCommand='--uninstall' Return='check' Impersonate='no' Execute='deferred' />
<InstallExecuteSequence>
<Custom Action='InstallAsService' After='InstallFiles' >NOT Installed</Custom>
<Custom Action='InstallAsServiceRollback' Before='InstallAsService' >NOT Installed</Custom>
<Custom Action='UninstallAsService' Before='RemoveFiles' >Installed</Custom>
</InstallExecuteSequence>
Both install and uninstall basically work. But during uninstall I get the following message:
The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup.
Despite this error message, the service gets unregistered and the files are deleted without a reboot. To me this looks like the installer is checking if CCWirelessServer.exe is opened before it executes my custom action.
So my question is: How do I need to modify my install execute sequence so that this error message does no longer appear?
If you are developing for Windows Installer > 3.1 you can take a look at the MSIRESTARTMANAGERCONTROL-property to see if it it set properly or if other values would would stop displaying the message.
I could suppress the message using the following values:
<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" Secure="yes" />

Install Driver using Executable

I am working on writing a WiX installer that needs to install a driver as a prerequisite. There is an executable that needs to be run that installs the driver on the PC. I don't want to install this executable on the host machine. There is both a x64 and x86 version and, depending on the platform, one or the other needs to be installed.
The executable is currently run using the command line:
C:\Comp\code\install\canned\tabload\x86>tabload install "*tab1394" "C:/Comp/code/install/canned/tab1394/x86"
The last argument is the location of the .cat, .sys and .inf files for the driver
The current code I have is:
<!-- Install correct device driver -->
<?if $(var.Platform) = x64?>
<Property Id="Win64">1</Property>
<?else?>
<Property Id="Win64">0</Property>
<?endif?>
<Binary Id="tabload64EXE" SourceFile="C:/Tableau/code/install/canned/tabload/x64/tabload.exe" />
<Binary Id="tabload32EXE" SourceFile="C:/Tableau/code/install/canned/tabload/x86/tabload.exe" />
<CustomAction Id="LaunchFile64"
BinaryKey="tabload64EXE"
ExeCommand='tabload "*tab1394" "C:/comp/code/install/canned/tab1394/x64 "'
Return="asyncNoWait" />
<CustomAction Id="LaunchFile32"
BinaryKey="tabload32EXE"
ExeCommand='tabload install "*tab1394" "C:/comp/code/install/canned/tab1394/x86 "'
Return="asyncNoWait" />
<InstallExecuteSequence>
<Custom Action="LaunchFile64" After="InstallFinalize">Win64</Custom>
<Custom Action="LaunchFile32" After="InstallFinalize">NOT Win64</Custom>
</InstallExecuteSequence>
I've looked at the tables in Orca. The Win64 property seems to be getting set correctly. The custom actions and binaries appear and the Target for the custom action is the indicated command line. The custom action is type 196 and I can't find any documentation for that online. When I build and install the installation package, the program is installed but the driver component is not installed. Please advise on how to remedy the situation.
Thanks!
The MSI SDK CustomAction table has the links to decipher the Type. I'm going to guess the root issue is that the custom actions are not deferred so they are not be executed by the elevated transaction.