I am using WiX toolset 3.11. I have an MSI installer which installs an App. During the installation of this App, I need to install other packages such as Python.
Now I am trying to install the installer of python version 3.9, that is, python-3.9.7.exe (32 bits) during the installer but without success. The Python package that I am trying to install is NOT an MSI, it is an exe file.
Below the code.
Product.wxs:
<CustomAction Id="PythonInstallerAction"
Return="ignore"
Execute="immediate"
BinaryKey="MyCustomActions.CA.dll"
DllEntry="PythonInstallerAction" />
<InstallExecuteSequence>
<Custom Action="PythonInstallerAction"
After="InstallFinalize">
<![CDATA[NOT Installed AND NOT UPGRADINGPRODUCTCODE AND NOT REMOVE]]>
</Custom>
</InstallExecuteSequence>
Then in my MyCustomActions class I have below code:
[CustomAction]
public static ActionResult PythonInstallerAction(Session session)
{
// ....
// I put harcoded the path to python exe here to be clearer. In the real scenario
// the python exe file is copied to temp directory and get it here from the temp dir.
string pythonInstallerPath = @"C:\Users\myUser\AppData\Local\Temp\python-3.9.7.exe";
try
{
var process = new Process
{
StartInfo =
{
FileName = pythonInstallerPath ,
Arguments = "/passive",
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true
}
};
process.Start();
process.WaitForExit();
}
catch (Exception ex)
{
session.Log("PythonInstallerAction: Error installing Python: " + ex);
result = ActionResult.Failure;
}
// ....
}
When I install my MSI, the Python installer appears and starts installing perfectly but it looks like it does not complete (no errors are shown in the UI nor in the WiX logs) or gets aborted and it disappears. Then the control is transferred to the MSI which was waiting for its completion and finally the MSI ends without any error.
I also have tried /quiet option instead of /passive. I want to use /passive because I want to skip past the user interaction but still display progress and errors.
Then I check in my system if Python is installed, and it does not appear as installed. What am I doing wrong?