![](/img/trans.png)
[英]C# WiX CustomAction Session.Log. Where can I find the log?
[英]Wix CustomAction [C#] session.Message is not show during the installation
这是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.Warning或InstallMessage.Error
session.Message(InstallMessage.Warning, new Record
{
FormatString = "Product updated. To upgrade Project execute initHeating.ps1"
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.