简体   繁体   English

WiX安装程序:DoAction运行的CustomAction中的日志消息

[英]WiX installer: Log message in CustomAction run by DoAction

I am writing a WiX installer with some custom action. 我正在使用一些自定义操作编写WiX安装程序。 I read here that Session.Log in a C# Custom Action doesn't work if the action is run as a result of a button click (DoAction). 在这里读到,如果由于单击按钮(DoAction)而运行该动作,则C#自定义动作中的Session.Log不起作用。 MSDN says that you can use the Message Method , so I tried with Session.Message: MSDN说您可以使用Message Method ,所以我尝试使用Session.Message:

var foo = new Record(1);
foo.SetString(0, "hello world");
session.Message(InstallMessage.ActionData, foo);

but I still can't see the log message even when using VERBOSE=1. 但是即使使用VERBOSE = 1,我仍然看不到日志消息。 The installer is created with WiX Burn so there isn't a separated msi. 安装程序是使用WiX Burn创建的,因此没有单独的msi。

Any help please? 有什么帮助吗?

Generally, this is a known issue with the underlying Windows Installer: 通常,这是基础Windows Installer的一个已知问题:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa368322(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/aa368322(v=vs.85).aspx

It seems that after Server 2003 the Message method may work but honestly I stopped using script custom actions years ago so it's not an option for me. 在Server 2003之后,似乎可以使用Message方法,但老实说,几年前,我停止使用脚本自定义操作,因此这不是我的选择。 I use C#/DTF which uses MsiProcessMessage. 我使用C#/ DTF使用MsiProcessMessage。

The usual workaround for this is to take advantage of the fact that property changes get logged. 通常的解决方法是利用属性更改被记录的事实。 Just set an unused property a bunch of times and you have your data in the log. 只需多次设置未使用的属性,就可以在日志中存储数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM