Is there any provision to kill system protected process in wix toolset.
I tried everything.
eg.
<InstallExecuteSequence>
<Custom Action='MyProcess.TaskKill' Before='InstallValidate'/>
</InstallExecuteSequence>
<Property Id="QtExecCmdLine"
Value='"C:\Windows\System32\taskkill.exe" /F /T /IM platform-agent-core.exe'/>
<CustomAction Id="MyProcess.TaskKill"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="ignore"/>
or
<closeApplication ... /> element
but nothing works
Thanks in advance..
Related
I have tried for 10 hours million things but I don't get it to work. Here is my code (extract):
<Fragment>
<util:RegistrySearch Id="VC_REDIST_Version"
Root="HKCR"
Variable="VCREDIST143431931"
Key="Installer\Dependencies\VC,redist.x86,x86,14.34,bundle"
Format="raw"
Value="Version"
Result="value" />
<ComponentGroup Id="ThirdPartyComponents" Directory="ExtSources">
<Component Id="Component_VC_redist_x86" Guid="2B80F89A-990A-438E-A475-9E72d8A0198A" >
<File Id="ExtSources_VC_redist.x86.exe" Name="VC_redist.x86.exe" Source="$(var.xxxxx_TargetDir)ExtSources\VC_redist.x86.exe" />
</Component>
</ComponentGroup>
<CustomAction Id="Install_VC_redist_x86"
Execute="immediate"
Impersonate="no"
Return="asyncNoWait"
FileKey="ExtSources_VC_redist.x86.exe"
ExeCommand="" />
<InstallExecuteSequence>
<Custom Action="Install_VC_redist_x86" After="InstallFinalize">NOT VCREDIST143431931</Custom>
</InstallExecuteSequence>
</Fragment>
But the problem is that the Custom action is executed always, independent from the state.
Any Idea what might be wrong?
UPDATE:
This is now how I did it and it works including skipping calling the installer when there is already a newer or same version of vc distrib installed:
<Fragment>
<Property Id="VCREDISTINSTALLED">
<RegistrySearch Id="VCRedistInstalledSearch"
Root="HKCR"
Key="Installer\Dependencies\VC,redist.x86,x86,14.34,bundle"
Name="Version"
Type="raw"
Win64="no"/>
</Property>
<ComponentGroup Id="ThirdPartyComponents" Directory="ExtSources">
<Component Id="Component_VC_redist_x86" Guid="2B80F89A-990A-438E-A475-9E72d8A0198A" >
<File Id="ExtSources_VC_redist.x86.exe" Name="VC_redist.x86.exe" Source="$(var.xxxxx_TargetDir)ExtSources\VC_redist.x86.exe" />
</Component>
</ComponentGroup>
<CustomAction Id="Install_VC_redist_x86"
Execute="immediate"
Return="asyncNoWait"
FileKey="ExtSources_VC_redist.x86.exe"
ExeCommand="/quiet /norestart" />
<InstallExecuteSequence>
<Custom Action="Install_VC_redist_x86" After="InstallFinalize"><![CDATA[VCREDISTINSTALLED < "14.34.31931.0" AND NOT REMOVE]]></Custom>
</InstallExecuteSequence>
</Fragment>
You'll want to use RegistrySearch instead of util:RegistrySearch. The util:RegistrySearch is only recognized in Bundles. In WiX v4, there is a error message but in WiX v3 it is silently ignored.
I am not sure if i am missing something or i just plain dumb, the issue i am having related to uninstalling a MSI. Basically i am building a app, and using WIX to create the MSI installer. What is happening is that i am able to install a previous version of the app but not upgrade to a newer version MSI. E.g, when i click/install the newer version MSI then the older MSI, both MSI will be installed and visible in control panel(MyApp 1.5.0, MyApp 1.6.0).
I am pretty sure i have the "MINORUPGRADE/MAJORUPGRADE" along with the RemoveExistingProducts Action configured properly but this issue still happens.
I tried modifying the MINORUPGRADE/MAJORUPGRADE values and the RemoveExistingProducts property but still get the same behavior.
My WIX config looks like this (without the Directory/paths...)
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Language="1033" Manufacturer="MyApp" Name="MyApp $(env.APP_BASE_VERSION)" UpgradeCode="$(env.UPGRADE_CODE)"
Version="$(env.APP_BASE_VERSION)">
<Package Compressed="yes" InstallerVersion="200" InstallScope="perMachine" InstallPrivileges="elevated" Description="MyApp $(env.APP_VERSION) Installer"
Comments="" Manufacturer="MyApp" />
<Property Id="MsiLogging" Value="v!" />
<MediaTemplate EmbedCab="yes" CompressionLevel="$(env.COMPRESSION_LEVEL)"/>
<Icon Id="icon.ico" SourceFile="$(env.STATIC_RESOURCE_PATH)\icon.ico" />
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Upgrade Id="$(env.UPGRADE_CODE)">
<UpgradeVersion
Property="MAJORUPGRADE"
Minimum="0.0.0.0"
IncludeMinimum="yes"
Maximum="$(env.APP_BASE_VERSION)"
IncludeMaximum="no"
IgnoreRemoveFailure="no"
MigrateFeatures="yes" />
<UpgradeVersion
Property="MINORUPGRADE"
Maximum="$(env.APP_BASE_VERSION)"
Minimum="$(env.APP_BASE_VERSION)"
IncludeMinimum="yes"
IncludeMaximum="yes"
/>
</Upgrade>
...
<CustomAction Id="Remove_Roaming_MyApp" Directory="TARGETDIR" ExeCommand="cmd.exe /C "rmdir /s /q "[AppDataFolder]\MyApp""" Execute="deferred" Return="ignore" HideTarget="yes" Impersonate="no" />
<Property Id="WixShellExecTarget" Value="[#MyAppEXE]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<util:CloseApplication Id="CloseApp" Target="MyApp.exe" RebootPrompt="no" CloseMessage="yes"/>
<CustomAction Id="Kill_MyApp_instances"
Directory="TARGETDIR"
ExeCommand="taskkill.exe /IM MyApp.exe /F"
Execute="deferred"
Return="ignore" HideTarget="yes" Impersonate="no" />
<!-- This will create a log in the Temp folder of the user profile by default. NOTE: this is not the full log! The MSI will need to be ran with `/l*v <destination file>` -->
<CustomAction Id="CopyLog_partial"
ExeCommand="cmd /c copy "[MsiLogFileLocation]" "%SystemDrive%\Windows\Temp\MyApp-msi.log""
Directory="TARGETDIR"
Impersonate="no"
Execute="commit"
Return="ignore" />
<CustomAction Id="CopyLog_full"
ExeCommand="cmd /c copy "[MsiLogFileLocation]" "[LocalAppDataFolder]\Temp\MyApp-msi.log""
Directory="TARGETDIR"
Impersonate="no"
Execute="immediate"
Return="ignore" />
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallValidate" />
<Custom Action="WixCloseApplications" Before="InstallValidate" />
<Custom Action="Kill_MyApp_instances" After='InstallInitialize'></Custom>
<Custom Action="LaunchApplication" After='InstallFinalize'>NOT Installed</Custom>
<Custom Action="CopyLog_partial" After="PublishProduct" />
<Custom Action="CopyLog_full" OnExit="success" />
</InstallExecuteSequence>
<Feature Id="ProductFeature" Title="SetupProject1" Level="1">
<ComponentGroupRef Id="ELECTRON_FRAGMENTS"/>
<ComponentRef Id="Remove_MyApp_Roaming_comp" />
<ComponentRef Id="Remove_uninstallCache_folder" />
<ComponentRef Id="Remove_MyApp_programFiles_comp" />
<ComponentRef Id="Shortcut_startMenu" />
</Feature>
</Product>
</Wix>
The intended behavior is to remove the previous MSI or better yet all versions installed during the installation process of the MSI. I know this can be done with a CustomAction but i was wondering if theres a more elegant way to do this?
Summary: When you get two entries in Add / Remove Programs the major upgrade has failed. I suggest you comment out all major upgrade
constructs and try to get a heartbeat with the simplest constructs
available - explained below.
Major Upgrade: You have used old constructs to implement your major upgrade. There is a newer and simple way, like this:
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
This is sort of like a "template" implementing the major upgrade with the least amount of fuzz by just using "normal options" or simplified options if you like. There is no need to add your own RemoveExistingProducts entry when you use this template, in fact that will probably yield a "duplicate entry / symbol" on compile:
Add the MajorUpgrade element above.
Comment out the entire Upgrade element.
Comment out the RemoveExistingProducts element.
Older Constructs: The MajorUpgrade element will be enough to implement a working major upgrade, but you can still use the old WiX constructs (Upgrade and UpgradeVersion elements) to obtain more fine-grained control of the authoring of the Upgrade table. It is this table which defines how existing installations are to be handled. The upgrade table identifies related products by matching upgrade codes and then performs whatever action is defined for that scenario in the Upgrade table itself.
Previous Answers: There are several older answers on this topic, please see the following:
Doing Major Upgrade in Wix creates 2 entries in Add/Remove Programs
Adding entries to MSI UpgradeTable to remove related products (this shows how to use both the newer template construct AND the older WiX element for "fine-grained" control of Upgrade table).
A Few More Links:
Upgrading a WiX generated package with major version zero
How to prevent Wix from installing an older version?
Wix UpgradeVersion
Checking for Oldies
UPDATE:
Unable to remove previous versions of MSI. Multiple entry's show up in control panel
WIX does not uninstall older version (potential causes of failed major upgrade)
Wix 3.10
After reading the article (Run ExeCommand in customAction as Administrator mode in Wix Installer),
I have used a deferred CustomAction with attribute Impersonate="no", calling a batch file with DISM command.
<Property Id="CMD">
<DirectorySearch Id="CmdFolder" Path="[SystemFolder]" Depth="1">
<FileSearch Id="CmdExe" Name="cmd.exe" />
</DirectorySearch>
</Property>
<Property Id="SXSPATH" Secure="yes" Value="SXSFOLDER" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="SXSFOLDER" />
</Directory>
<CustomAction Id="SetCustomActionData" Return="check" Property="OfflineSxSInstall" Value="[SXSFOLDER]" />
<CustomAction Id="OfflineSxSInstall" Property="CMD" Execute="deferred" Return="check" Impersonate="no" ExeCommand="/c ""[#file_configure.bat]" "[SXSFOLDER]""" />
<InstallExecuteSequence>
<Custom Action="OfflineSxSInstall" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
Sadly, always DISM returns error 11 "You cannot service a running 64-bit operating system with a 32-bit version of DISM.
Please use the version of DISM that corresponds to your computer's architecture"....
Firstly, I have tried to call proper CMD.exe and DISM.exe for the 64bit Windows 2012R2 test environment, ..... but always returns same error despite the absolute path of DISM, changing Path="[SystemFolder]" to "[System64Folder]"...
Then I found an article with Similar phenomenon (https://social.technet.microsoft.com/Forums/ie/en-US/e25c27cf-ca6d-4079-90a1-8201ffc503e5/dism-gives-error-11?forum=w8itprogeneral) It tells me that it derived from lack of permission...
Currently I have tried to solve the problem by using schtasks.exe clearly running as Administrator...(Probably with login and password by Wix public parameter....user input with Wix UI window, ugly....)
configure.bat
setlocal
echo @Starting Installation of IIS Role Services and .NET Framework.... @%DATE%_%TIME% >> C:\temp\test_configure.txt 2>&1
REM cd C:\Windows\SysWOW64
cd >> C:\temp\test_configure.txt 2>&1
echo %1 >> C:\temp\test_configure.txt 2>&1
SET SXS_SOURCE_PATH=%1
DISM.exe /Online /Enable-Feature /FeatureName:NetFx3 /All /Source:%SXS_SOURCE_PATH% >> C:\temp\test_configure.txt 2>&1
if !ERRORLEVEL! neq 0 (
ECHO interrupting Installation of IIS Role Services and .NET Framework....@%DATE%_%TIME% >> C:\temp\test_configure.txt 2>&1
EXIT /B 100
)
DISM.exe /Online /Enable-Feature /FeatureName:IIS-WebServerRole /FeatureName:IIS-RequestFiltering /FeatureName:IIS-Security /FeatureName:IIS-HttpLogging /FeatureName:IIS-HealthAndDiagnostics /FeatureName:IIS-WebServerManagementTools /FeatureName:IIS-ManagementConsole /FeatureName:IIS-IIS6ManagementCompatibility /FeatureName:IIS-Metabase /FeatureName:IIS-WebServer /FeatureName:IIS-Performance /FeatureName:IIS-HttpCompressionStatic /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-StaticContent /FeatureName:IIS-DefaultDocument /FeatureName:IIS-DirectoryBrowsing /FeatureName:IIS-HttpErrors /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-ASPNET /FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /all /Source:%SXS_SOURCE_PATH% >> C:\temp\test_configure.txt 2>&1
if !ERRORLEVEL! neq 0 (
ECHO @interrupting Installation of IIS Role Services and .NET Framework....@%DATE%_%TIME% >> C:\temp\test_configure.txt 2>&1
EXIT /B 100
)
echo @Complete Installation of IIS Role Services and .NET Framework....@%DATE%_%TIME% >> C:\temp\test_configure.txt 2>&1
endlocal
exit /B 0
Any ideas? I'm afraid that I must face something big thing like the DISM API....
P.S.
Following kind #Chris Riccio's advice, I stopped using batch file, and QuietExec works fine, while the AddIISComponent command is not so long. (If I used the comment out command, LIGHT warned "LGHT1076 : ICE03: String overflow (greater than length permitted in column); Table: CustomAction, Column: Target, Key(s): AddDISMComponent." )
<CustomAction Id="SetCustomActionData" Return="check" Property="AddDISMComponent" Value="[SXSFOLDER]" />
<!--<CustomAction Id='AddDISMComponent' Property='DISMComponent' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServerRole /FeatureName:IIS-RequestFiltering /FeatureName:IIS-Security /FeatureName:IIS-HttpLogging /FeatureName:IIS-HealthAndDiagnostics /FeatureName:IIS-WebServerManagementTools /FeatureName:IIS-ManagementConsole /FeatureName:IIS-IIS6ManagementCompatibility /FeatureName:IIS-Metabase /FeatureName:IIS-WebServer /FeatureName:IIS-Performance /FeatureName:IIS-HttpCompressionStatic /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-StaticContent /FeatureName:IIS-DefaultDocument /FeatureName:IIS-DirectoryBrowsing /FeatureName:IIS-HttpErrors /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-ASPNET /FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /FeatureName:NetFx3 /all /Source:[SXSFOLDER]' Execute='immediate'/>-->
<CustomAction Id='AddDISMComponent' Property='DISMComponent' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServerRole /FeatureName:NetFx3 /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="ignore" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="AddDISMComponent" After="CostFinalize" />
<Custom Action="DISMComponent" After="InstallInitialize"><![CDATA[(NOT Installed)]]></Custom>
</InstallExecuteSequence>
I have currently tried to call multiple QuietExec-DISM commands chopping up the long parameters...
Not smart....
<CustomAction Id='AddDISMComponent1' Property='DISMComponent1' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServerRole /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent1" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent2' Property='DISMComponent2' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-RequestFiltering /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent2" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="AddDISMComponent1" After="CostFinalize" />
<Custom Action="AddDISMComponent2" After="AddDISMComponent1" />
<Custom Action="DISMComponent1" After="InstallInitialize"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent2" After="DISMComponent1"><![CDATA[(NOT Installed)]]></Custom>
</InstallExecuteSequence>
You can use the built in Wix QuietExec custom action to run the dism command line - this should simplify the installer quite a bit
<CustomAction Id='AddIISComponent' Property='IISComponent' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /featurename:IIS-WebServerRole /all' Execute='immediate'/>
<CustomAction Id="IISComponent" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="ignore" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="AddIISComponent" After="CostFinalize" />
<Custom Action="IISComponent" After="InstallInitialize"><![CDATA[(NOT Installed)]]></Custom>
</InstallExecuteSequence>
Here's a complete sample
Not smart as I expected....but works.
<CustomAction Id='AddDISMComponent1' Property='DISMComponent1' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServerRole /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent1" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent2' Property='DISMComponent2' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-RequestFiltering /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent2" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent3' Property='DISMComponent3' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-HttpLogging /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent3" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent4' Property='DISMComponent4' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-HealthAndDiagnostics /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent4" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent5' Property='DISMComponent5' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServerManagementTools /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent5" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent6' Property='DISMComponent6' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ManagementConsole /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent6" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent7' Property='DISMComponent7' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-IIS6ManagementCompatibility /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent7" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent8' Property='DISMComponent8' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-Metabase /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent8" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent9' Property='DISMComponent9' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-WebServer /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent9" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent10' Property='DISMComponent10' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-Performance /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent10" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent11' Property='DISMComponent11' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-HttpCompressionStatic /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent11" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent12' Property='DISMComponent12' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-CommonHttpFeatures /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent12" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent13' Property='DISMComponent13' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-StaticContent /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent13" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent14' Property='DISMComponent14' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-DefaultDocument /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent14" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent15' Property='DISMComponent15' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-DirectoryBrowsing /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent15" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent16' Property='DISMComponent16' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-HttpErrors /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent16" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent17' Property='DISMComponent17' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ApplicationDevelopment /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent17" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent18' Property='DISMComponent18' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ASPNET /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent18" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent19' Property='DISMComponent19' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-NetFxExtensibility /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent19" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent20' Property='DISMComponent20' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ISAPIExtensions /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent20" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent21' Property='DISMComponent21' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:IIS-ISAPIFilter /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent21" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id='AddDISMComponent22' Property='DISMComponent22' Value='"[System64Folder]dism.exe" /norestart /quiet /online /enable-feature /FeatureName:NetFx3 /all /Source:[SXSFOLDER]' Execute='immediate'/>
<CustomAction Id="DISMComponent22" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="AddDISMComponent1" After="CostFinalize" />
<Custom Action="AddDISMComponent2" After="AddDISMComponent1" />
<Custom Action="AddDISMComponent3" After="AddDISMComponent2" />
<Custom Action="AddDISMComponent4" After="AddDISMComponent3" />
<Custom Action="AddDISMComponent5" After="AddDISMComponent4" />
<Custom Action="AddDISMComponent6" After="AddDISMComponent5" />
<Custom Action="AddDISMComponent7" After="AddDISMComponent6" />
<Custom Action="AddDISMComponent8" After="AddDISMComponent7" />
<Custom Action="AddDISMComponent9" After="AddDISMComponent8" />
<Custom Action="AddDISMComponent10" After="AddDISMComponent9" />
<Custom Action="AddDISMComponent11" After="AddDISMComponent10" />
<Custom Action="AddDISMComponent12" After="AddDISMComponent11" />
<Custom Action="AddDISMComponent13" After="AddDISMComponent12" />
<Custom Action="AddDISMComponent14" After="AddDISMComponent13" />
<Custom Action="AddDISMComponent15" After="AddDISMComponent14" />
<Custom Action="AddDISMComponent16" After="AddDISMComponent15" />
<Custom Action="AddDISMComponent17" After="AddDISMComponent16" />
<Custom Action="AddDISMComponent18" After="AddDISMComponent17" />
<Custom Action="AddDISMComponent19" After="AddDISMComponent18" />
<Custom Action="AddDISMComponent20" After="AddDISMComponent19" />
<Custom Action="AddDISMComponent21" After="AddDISMComponent20" />
<Custom Action="AddDISMComponent22" After="AddDISMComponent21" />
<Custom Action="DISMComponent1" After="InstallInitialize"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent2" After="DISMComponent1"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent3" After="DISMComponent2"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent4" After="DISMComponent3"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent5" After="DISMComponent4"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent6" After="DISMComponent5"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent7" After="DISMComponent6"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent8" After="DISMComponent7"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent9" After="DISMComponent8"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent10" After="DISMComponent9"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent11" After="DISMComponent10"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent12" After="DISMComponent11"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent13" After="DISMComponent12"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent14" After="DISMComponent13"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent15" After="DISMComponent14"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent16" After="DISMComponent15"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent17" After="DISMComponent16"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent18" After="DISMComponent17"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent19" After="DISMComponent18"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent20" After="DISMComponent19"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent21" After="DISMComponent20"><![CDATA[(NOT Installed)]]></Custom>
<Custom Action="DISMComponent22" After="DISMComponent21"><![CDATA[(NOT Installed)]]></Custom>
</InstallExecuteSequence>
This code works:
<CustomAction Id="StopVBS" Directory="INSTALLDIR" ExeCommand="wscript.exe stop.vbs" Execute="immediate" Return="ignore" />
This is the problem, because the script is not located in the INSTALLDIR:
<Binary Id="StopAll" SourceFile="source\stop-all.vbs" />
<CustomAction Id="StopAllVBS" BinaryKey="StopAll" ExeCommand="wscript.exe stop-all.vbs" Execute="immediate" Return="ignore">
</CustomAction>
<InstallUISequence>
<Custom Action="StopAllVBS" After="CostFinalize" />
</InstallUISequence>
Any help would be appreciated!
How do I launch my application after install with no UI (or in quiet mode)? Thanks!
I had a installer with UI which has an option to run after install. Now I want my application to updates itself by downloading and running the new version of installer in quiet mode, but after updating done, it won't launch again.
From the msdn topic on sequencing custom actions:
As in the case of standard actions,
custom actions that are scheduled in
the InstallUISequence or
AdminUISequence run only if the
internal user interface is set to the
full level.
So I guess your custom action is scheduled in a UI sequence, not in InstallExecuteSequence. Try scheduling your custom action in the InstallExecuteSequence like this:
<InstallExecuteSequence>
<Custom Action='LaunchApplication' After='InstallFiles'/>
</InstallExecuteSequence>
where "LaunchApplication" should be replaced by the Id of your CustomAction element.
edit: I looked at the instructions that you followed, and I don't see the custom action for launching the application being scheduled in any sequence. It is only triggered from a UI action (clicking the Finish button). This explains why it is never executed during a silent install.
edit: full sample (it's a bit sloppy as it also tries to execute the custom action on uninstall, repair etc. but for some reason I couldn't get the "NOT Installed" condition to work)
<?xml version='1.0' encoding='utf-8'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Name='ProductName'
Id='*'
Language='1033'
Version='0.0.1'
Manufacturer='ManufacturerName' >
<Package
Keywords='Installer'
Description='Launch application demo'
Manufacturer='ManufactererName'
InstallerVersion='100'
Languages='1033'
Compressed='yes'
SummaryCodepage='1252'/>
<Media Id='1' Cabinet='test.cab' EmbedCab='yes'/>
<Directory Id='TARGETDIR' Name="SourceDir">
<Directory Id='ProgramFilesFolder'>
<Directory Id='TestFolder' Name='Test' >
<Component Id="ExeComponent" Guid="*">
<File Id="ExeFile" Source="c:\windows\notepad.exe" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete'
Display='expand'
Level='1'
Title='Test'
Description='Test'>
<ComponentRef Id="ExeComponent" />
</Feature>
<InstallExecuteSequence>
<Custom Action='LaunchInstalledExe' After='InstallFinalize'/>
</InstallExecuteSequence>
<CustomAction Id="LaunchInstalledExe"
FileKey="ExeFile"
ExeCommand=""
Execute="immediate"
Impersonate="yes"
Return="asyncNoWait" />
</Product>
</Wix>
In my final solution I used two properties, one for UI (LAUNCH_APP_ON_EXIT), one for command line arguments (UPDATING_AUTOMATICALLY).
I have to do this because if I run the CustomAction after InstallFinalize in full UI mode, the application would start before you click the "Finish" button.
Now I can call setup.exe /qn UPDATING_AUTOMATICALLY=1 in my program to update.
Here is it all:
<Property Id="LAUNCH_APP_ON_EXIT" Value="1" />
<Property Id="UPDATING_AUTOMATICALLY" Value ="0" />
<CustomAction Id="LaunchApplication" FileKey="mainExecutableFile" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
<UI>
<!-- explainations: http://www.dizzymonkeydesign.com/blog/misc/adding-and-customizing-dlgs-in-wix-3/ -->
<UIRef Id="MyWixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText"/>
<Publish Dialog="MyExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">LAUNCH_APP_ON_EXIT</Publish>
</UI>
<InstallExecuteSequence>
<Custom Action='LaunchApplication' After='InstallFinalize'>UPDATING_AUTOMATICALLY = 1</Custom>
</InstallExecuteSequence>
I would assume that you are launching your app from a custom action, which is triggered through a property bound to the checkbox. If that is the case, you can try specifying that property as a command line argument to setup.exe. Say, if your custom action is bound to the MSI property LAUNCH_NEW_VERSION, you can call setup.exe like this:
setup.exe /q LAUNCH_NEW_VERSION=1
The standard setup bootstrapper should pass that property/value to the MSI engine. If it doesn't, you might consider invoking the .msi directly instead of calling the bootstrapper exe to run your installer.
This is the approach I took.
<Property Id="WixShellExecTarget" Value="[#(the id of your exe here)]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
This will execute which ever file id you enter in the Value. The [# ] is needed. I used this and ran it via the UI but you should be able to call this custom action anywhere and it work.