Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wix CustomAction [C#] session.Message is not show during the installation

This is WIX script fragment

<InstallExecuteSequence>
    <Custom Action="Warning" After="InstallFinalize">NOT INSTALLED</Custom>
</InstallExecuteSequence>
<CustomAction Id="Warning" BinaryKey="ExtendedActions" DllEntry="WarningAboutUpgrade" Execute="immediate" Return="check"/>
<Binary Id="ExtendedActions" SourceFile="$(var.ExtendedActions.TargetDir)$(var.ExtendedActions.TargetName).CA.dll" />

This is c# custom action code

using Microsoft.Deployment.WindowsInstaller;

namespace ExtendedActions
{
    public class CustomActions
    {
        [CustomAction]
        public static ActionResult WarningAboutUpgrade(Session session)
        {
            session.Log($"Begin CustomAction WarningAboutUpgrade");
            session.Message(InstallMessage.Info, new Record { FormatString = "Product updated. To upgrade Project execute initHeating.ps1 }" });
            return ActionResult.Success;
        }
    }
}

during the install process Message is not shown;

like image 402
drgrd Avatar asked Nov 18 '15 07:11

drgrd


1 Answers

That's because you call session.Message with the parameter InstallMessage.Info. This causes that the text will not be shown to the user. The message can be found in the log-file instead. This behaviour is by design.

To archive your goal change the first parameter to InstallMessage.Warning or InstallMessage.Error

session.Message(InstallMessage.Warning, new Record 
{ 
  FormatString = "Product updated. To upgrade Project execute initHeating.ps1" 
});
like image 53
Stefan Wanitzek Avatar answered Sep 28 '22 02:09

Stefan Wanitzek