I am building msi installer using wixsharp with silent installation using command line without any User Interface. I am having many custom action methods similar to the following for checking prerequisite conditions. I want to warn the users if prerequisite conditions are not met.
var project = new Project("ProductName",
new ManagedAction(new Id("OSVersion"), Check.CheckOSVersion, Return.check, When.Before, Step.InstallInitialize, Condition.NOT_Installed));
Custom action methods returns ActionResult.Failure if conditions are not met.
My batch script is below
start /wait msiexec /i Installer.msi /qn /l*v installerlog.log
if "%errorlevel%" == "1013" goto err
if "%errorlevel%" == "1603" goto err
:err
echo "Error: Msiexec failed with errorlevel = %errorlevel%"
pause
exit /b %errorlevel%
Is it possible to make the MSI installer return custom error code and custom error messages like "OS Version Invalid" and display the same in command line. ?
You cannot change the msiexec exitcode - it returns a Windows value, not one you can customize.
Custom error messages are typically done with a custom action that calls MsiProcessMessage with INSTALLMESSAGE_ERROR, and they'd go in the MSI log too.
I don't know exactly what displaying the error in the command line means, but a silent install really is a silent install and the install won't display anything. In what way do you want a silent install but also display a message, making it non-silent? Will the /qb options work so that you see progress and errors?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.