简体   繁体   中英

WiX installer: Log message in CustomAction run by DoAction

I am writing a WiX installer with some custom action. 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). MSDN says that you can use the Message Method , so I tried with 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. The installer is created with WiX Burn so there isn't a separated msi.

Any help please?

Generally, this is a known issue with the underlying Windows Installer:

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. I use C#/DTF which uses 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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