gpt4 book ai didi

c# - Wix CustomAction [C#] session.Message 在安装过程中不显示

转载 作者:太空狗 更新时间:2023-10-29 23:13:40 25 4
gpt4 key购买 nike

这是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;
}
}
}

安装过程中未显示消息;

最佳答案

那是因为您使用参数 InstallMessage.Info 调用了 session.Message。这会导致文本不会显示给用户。该消息可以在日志文件中找到。此行为是设计使然。

要存档您的目标,请将第一个参数更改为 InstallMessage.WarningInstallMessage.Error

session.Message(InstallMessage.Warning, new Record 
{
FormatString = "Product updated. To upgrade Project execute initHeating.ps1"
});

关于c# - Wix CustomAction [C#] session.Message 在安装过程中不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33773786/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com