the following sequence executes correctly on Windows 10 but on Windows 7 seems not to execute:
<Component Id="TargetProgram" Win64="yes" Guid="32BBAECC-AC90-4F79-8E59-8D5B3FA5D4DE">
<File Id="EXE" Source="c:\Windows\system32\sc.exe" />
</Component>
<CustomAction Id="EXECUTE_AFTER_FINALIZE"
Execute="immediate"
Impersonate="no"
Return="asyncWait"
FileKey="EXE"
ExeCommand="config SomeService start=delayed-auto" />
<InstallExecuteSequence>
<Custom Action="EXECUTE_AFTER_FINALIZE" After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
Do anybody know what the problem is under Windows7? Thanks.
Related
I have the following custom actions which normally remove the exe from windows service and add it back,
<CustomAction Id="ExecRemoveService" Directory="INSTALLDIR" Execute="immediate" ExeCommand="MyExe.exe -remove" Return="ignore" />
<CustomAction Id="ExecInstallService" Directory="INSTALLDIR" Execute="immediate" ExeCommand="MyExe.exe -install" Return="ignore" />
<InstallExecuteSequence>
<Custom Action="ExecRemoveService" After="InstallFinalize" />
<Custom Action="ExecInstallService" After="InstallFinalize" />
</InstallExecuteSequence>
When run the MSI nothing happening, it successfully finish but nothing inside windows service I am seeing.
This one worked for me,
<CustomAction
Id="ExecInstallService"
Directory="INSTALLDIR"
Execute="deferred"
ExeCommand='cmd.exe /k "MyService.exe -remove & MyService.exe -install & exit"' Return="check" Impersonate="no" />
I'm trying to open different URLs based when app is installed and uninstalled. Currently this setup opens both URLs when uninstalling but nothing when installing.
<Property Id="InstallURL">$(var.HomepageURL)install?ver=$(var.VersionNumber)</Property>
<Property Id="UninstallURL">$(var.HomepageURL)uninstall?ver=$(var.VersionNumber)</Property>
<CustomAction Id="SetOpenInstallURL" Property="WixShellExecTarget" Value="[InstallURL]" />
<CustomAction Id="SetOpenUninstallURL" Property="WixShellExecTarget" Value="[UninstallURL]" />
<CustomAction Id="OpenInstallURL" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore" />
<CustomAction Id="OpenUninstallURL" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore" />
<InstallExecuteSequence>
<!-- Launch webpage during install -->
<Custom Action='SetOpenInstallURL' After='InstallFinalize'><![CDATA[Installed]]></Custom>
<Custom Action="OpenInstallURL" After="SetOpenInstallURL"></Custom>
</InstallExecuteSequence>
<InstallExecuteSequence>
<!-- Launch webpage during full uninstall, but not upgrade -->
<Custom Action="SetOpenUninstallURL" After="InstallFinalize"><![CDATA[REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE]]></Custom>
<Custom Action="OpenUninstallURL" After="SetOpenUninstallURL"></Custom>
</InstallExecuteSequence>
Another attempt after examining msi log at https://gist.github.com/raspi/7072ecdb43d929901e3d228893cfa124
<Property Id="InstallURL">$(var.HomepageURL)install?ver=$(var.VersionNumber)</Property>
<Property Id="UninstallURL">$(var.HomepageURL)uninstall?ver=$(var.VersionNumber)</Property>
<!-- Set value of WixShellExecTarget property to value of InstallURL if this is first time install -->
<SetProperty Id="WixShellExecTarget" Action="SetInstallURL" Value="[InstallURL]" Before="OpenURL" Sequence="execute">NOT Installed</SetProperty>
<!-- Set value of WixShellExecTarget property to value of UninstallURL if this is uninstall -->
<SetProperty Id="WixShellExecTarget" Action="SetUninstallURL" Value="[UninstallURL]" Before="OpenURL" Sequence="execute">REMOVE</SetProperty>
<CustomAction Id="OpenURL" BinaryKey="WixCA" DllEntry="WixShellExec" Return="ignore" />
<InstallExecuteSequence>
<Custom Action="OpenURL" After="InstallFinalize"/>
</InstallExecuteSequence>
I use following configuration to start my server after installation of application:
<InstallExecuteSequence>
<Custom Action='LaunchApplication' After='InstallFinalize'/>
</InstallExecuteSequence>
<Property Id="WixShellExecTarget" Value="[#startServer.vbs]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Execute="immediate"
Impersonate="yes" />
Installer executes script startServer.vbs at the end of installation procedure.
What property Id should I use if I need to execute several custom actions?
For example if I will use following configuration. What property Id should I use for StopApplication custom action?
<InstallExecuteSequence>
<Custom Action='LaunchApplication' After='InstallFinalize'/>
<Custom Action='StopApplication' Before='InstallValidate'/>
</InstallExecuteSequence>
<Property Id="WixShellExecTarget" Value="[#startServer.vbs]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Execute="immediate"
Impersonate="yes" />
<Property Id="???" Value="[#stopServer.vbs]" />
<CustomAction Id="StopApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Execute="immediate"
Impersonate="yes" />
UPDATE:
There is error "There is a problem with this Windows Installer package. A script required for this install to complete could not be run." during installation if I use following configuration:
<InstallExecuteSequence>
<Custom Action='StartServerCustomAction' After='InstallFinalize'/>
</InstallExecuteSequence>
<Binary Id='StartServerScript' SourceFile='startServer.vbs' />
<CustomAction Id='StartServerCustomAction' BinaryKey='StartServerScript' JScriptCall='startServerSub' Return='check' />
startServer.vbs
Public Function startServerSub()
Return 0
End Function
I need to get my Custom Action to run as an x64 bit process and am using Visual Studio 2010. When i run the msi i see the following entry in the verbose log file:
Hello, I'm your 32bit Elevated custom action server
and the custom action fails due to wrong processor architecture (I am calling DISM.exe via a batch file). My project is fairly simple:
<DirectoryRef Id="APPLICATIONROOTDIRECTORY" >
<Component Id="Launch.cmd" Guid="{423CD408-F053-496B-8FA7-6C329A2F53BB}" Win64="yes">
<File Id="Launch.cmd" Name="Launch.cmd" Source="C:\Temp\Build\MSU Wrapper for SCUP\Launch.cmd" KeyPath="yes" Checksum="yes" ProcessorArchitecture="x64"/>
</Component>
<Component Id="KB977453.cab" Guid="{E8ABB2AE-6F57-4153-B44C-E1083D6702B1}" Win64="yes">
<File Id="KB977453.cab" Name="KB977453.cab" Source="C:\Temp\Build\MSU Wrapper for SCUP\KB977453.cab" KeyPath="yes" Checksum="yes" ProcessorArchitecture="x64"/>
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="Launch.cmd" />
<ComponentRef Id="KB977453.cab" />
</Feature>
<CustomAction Id="BatchCmd" Property="BatchRun" Value=""[#Launch.cmd]" KB977453" Execute="immediate"/>
<CustomAction Id="BatchRun" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="BatchCmd" Before="BatchRun">NOT Installed</Custom>
<Custom Action="BatchRun" After="InstallFiles">NOT Installed</Custom>
<ScheduleReboot After="InstallFinalize" />
</InstallExecuteSequence>
</Product>
I have x64 release selected in Configuration Manager in Visual Studio. Does anyone have an idea of what is wrong?
Set DllEntry="CAQuietExec64" for x64 custom actions
http://wix.sourceforge.net/manual-wix3/qtexec.htm
I have several properties to set when ALLUSERS is 1:
<CustomAction Id="CA1" Property="InstallDir" Value="[MYINSTALLDIR]" Execute="immediate" />
<CustomAction Id="CA2" Property="Version" Value="2.0" Execute="immediate" />
<CustomAction Id="CA3" Property="x" Value="x" Execute="immediate" />
<CustomAction Id="CA4" ... />
<CustomAction Id="CA5" ... />
<InstallExecuteSequence>
<Custom Action="CA1" After="AppSearch">ALLUSERS=1</Custom>
<Custom Action="CA2" After="AppSearch">ALLUSERS=1</Custom>
<Custom Action="CA3" After="AppSearch">ALLUSERS=1</Custom>
<Custom Action="CA4" After="AppSearch">ALLUSERS=1</Custom>
<Custom Action="CA5" After="AppSearch">ALLUSERS=1</Custom>
</InstallExecuteSequence>
This is working but I'm wondering if there is more concise way instead of tons of CAs and stupid IDs, something like:
<CustomAction Id="CA" Property="InstallDir=[MYINSTALLDIR]; Version=2.0; x=x; y=y; z=z ..." Execute="immediate" />
<InstallExecuteSequence>
<Custom Action="CA" After="AppSearch">ALLUSERS=1</Custom>
</InstallExecuteSequence>
Is this possible?
You could write a C++ custom action that calls MsiSetProperty() a bunch of times. There will technically be more risk for failure though. Once setup, a bunch of set property CA's is usually not that horrible.