0

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. ?

AnandhaSundari M
  • 1,098
  • 2
  • 10
  • 23

1 Answers1

1

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?

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • I am new to installers and my question may be wrong. /qb option opens a separate dialog and displays the session.Message() value. I want to display the same in command line without any dialogs. Is there any option to return the INSTALL_MESSAGE_ERROR so that it can be captured by batch script.? And also, I am using WixSharp library in .NET to create the installers. – AnandhaSundari M May 31 '17 at 04:31