这是WIX脚本片段
<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" />
这是c#自定义操作代码
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;
}
}
}
在安装过程中消息未显示;
答案 0 :(得分:5)
这是因为您使用参数 InstallMessage.Info 调用 session.Message 。这导致文本不会显示给用户。可以在日志文件中找到该消息。这种行为是设计使然。
要归档您的目标,请将第一个参数更改为 InstallMessage.Warning 或 InstallMessage.Error
session.Message(InstallMessage.Warning, new Record
{
FormatString = "Product updated. To upgrade Project execute initHeating.ps1"
});