Platform: (Development) Windows 7 x64, Wix 3.10 (but probably this installer will by used only for Server OS)
I want to make "Next" button of my Wix msi installer window to call a console command DISM with a parameter (path to SxS folder, see my past post):
WiX Cannot input session value to a text box (with CustomAction)
https://stackguides.com/questions/48259260/wix-cannot-input-session-value-to-a-text-box-with-customaction
If I understand correctly (Please if there is any mistake, could you please revise the condition below?): 1) There are CustomAction types in Windows msi installer defined in the Custom Action table:
CustomAction Table
https://msdn.microsoft.com/ja-jp/library/aa368062.aspx
If I want to set parameter to the console command and to call console command (probably with an Administrator account), I must choose a certain type (50?) by using certain parameters in the Wix Custom Action element tag, right? (I think I cannot explicitly choose a type of msi Custom Action...)
CustomAction Element
http://wixtoolset.org/documentation/manual/v3/xsd/wix/customaction.html
2) I want to use CustomAction Execute:"immediate"ly after pushing a "Next" button, but I am afraid that an immediate Custom Action cannot call it with an elevated status, (probably DISM command will not work without Administrator privilege...) I will try and get error, but please teach me if I should change to Execute: "deferred" before I would have exhausted. (I think right-clicking msi "running as administrator" is not a problem, probably.)
WIX CUSTOM ACTION CALL AFTER NEXT
https://stackguides.com/questions/17227368/wix-custom-action-call-after-next
WIX: How to run application with parameters from custom action?
https://alexanderst.wordpress.com/2010/10/28/wix-how-to-run-application-with-parameters-from-custom-action/
Any Ideas? Thank you.
After several attempt.... Currently my msi ends with runtime error, when the CustomAction is fired. (hogehoge.bat is blank text file, and the error doesn't happen when the Publish Event="DoAction" tag is comment out.)
main.wxs
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="HogeHoge" Name="HogeHoge">
<Directory Id="INSTALLDIR" Name="Hoge 1.0">
<Component Id="HogeHogeLibrary" Guid="MY-GUID">
<File Id="test.bat" Name="test.bat" DiskId="1" Source="test.bat" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
</Directory>
<Directory Id="SxSFolder" Name="SxS" />
<Directory Id="SQLServerFolder" Name="SQLServer">
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id="Complete" Title="HogeHoge 1.12.0" Description="Complete Package" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
<Feature Id="MainProgram" Title="Program" Description="Main Program" Level="1">
<ComponentRef Id="HogeHogeLibrary" />
</Feature>
<Component Id="hogehoge" Guid="MY-GUID" Directory="TARGETDIR">
<File Id="hogehoge" DiskId="1" Name="hogehoge.bat" KeyPath="yes" Source="hogehoge.bat" />
</Component>
</Feature>
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<DialogRef Id="WindowsServerRolesAndFeaturesDlg" />
<DialogRef Id="SQLServerInstallDlg" />
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="WindowsServerRolesAndFeaturesDlg" Order="2">
LicenseAccepted = "1"
</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="NewDialog" Value="SQLServerInstallDlg" Order="2">
LicenseAccepted = "1"
</Publish>
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="SQLServerInstallDlg">
1
</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">LicenseAccepted = "1"</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="SetTargetPath" Value="[SXS_PATH]" Order="2">1</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[SXS_PATH]" Order="1">1</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="SQLServerInstallDlg" Control="Back" Event="NewDialog" Value="WindowsServerRolesAndFeaturesDlg">LicenseAccepted = "1"</Publish>
<Publish Dialog="SQLServerInstallDlg" Control="Next" Event="SetTargetPath" Value="[SQLSERVER_INSTANCE_PATH]" Order="2">1</Publish>
<Publish Dialog="SQLServerInstallDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[SQLSERVER_INSTANCE_PATH]" Order="1">1</Publish>
<Publish Dialog="SQLServerInstallDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</UI>
<UIRef Id="WixUI_ErrorProgressText" />
</Product>
main.wxs
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<!--<CustomAction Id="OnlineSxSInstall" Return="check" Execute="immediate" ExeCommand="install_win2012_online" />-->
<CustomAction Id="OfflineSxSInstall" Property="CMD" Return="check" Execute="immediate" ExeCommand="/c ""[#hogehoge]""" />
<Property Id="ONOFF_PROPERTY" Secure="yes" Value="0" />
<UI>
<Dialog Id="WindowsServerRolesAndFeaturesDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="RdxOnlineOffline" Type="RadioButtonGroup" X="40" Y="63" Width="200" Height="35" Property="ONOFF_PROPERTY" Text="Choose install method:">
<RadioButtonGroup Property="ONOFF_PROPERTY">
<RadioButton Value="0" X="0" Y="0" Width="300" Height="15" Text="local package or online windows update available" />
<RadioButton Value="1" X="0" Y="20" Width="300" Height="15" Text="Require offline install from a media" />
</RadioButtonGroup>
</Control>
<Control Id="SourcePath" Type="Text" X="45" Y="98" Width="200" Height="15" TabSkip="no" Text="Input Sxs path when offline(&U):" />
<Control Type="PathEdit" Id="TxtDir" X="45" Y="110" Width="220" Height="18" Property="SXS_PATH" Indirect="yes">
<Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
<Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
</Control>
<Control Id="ChangeFolder" Type="PushButton" X="265" Y="110" Width="56" Height="18" Text="Browse...">
<Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
<Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back(&B)">
<Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next(&N)">
<Publish Event="DoAction" Value="OfflineSxSInstall">1</Publish>
<Publish Event="NewDialog" Value="SQLServerInstallDlg" />
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Install Windows IIS role and .NET Framework features</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\WixUI_Font_Title}Set IIS role and .NET Framework 3.5 features</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
</UI>
</Fragment>
</Wix>
Any ideas?