Wix C# 自定义操作日志不起作用 [英] Wix C# Custom Action Logging Not Working

查看:19
本文介绍了Wix C# 自定义操作日志不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 session.Log("Hello World!"); 从我的 C# 自定义操作中记录日志.执行我的 msi 时,这不会显示在我的日志文件中,如下所示:

I am trying to log from my C# Custom Action using session.Log( "Hello World!" ); This does not show up in my log file when executing my msi as follows:

msiexec/i myMsi.msi/lvx myLog.log

我的自定义操作运行良好,我唯一的问题是我没有获得 my 日志信息.日志显示我的 CA 被调用,而不是来自 session.Log() 调用的信息.

My custom action works fine, my only problem is I do not get my logging info. The log shows my CA is getting called, just not the info from my session.Log() call.

我正在使用 Wix 3.5、.Net 4、VS 2010 和 64 位 Windows 7.我正在调用我的操作如下.

I am using Wix 3.5, .Net 4, VS 2010, and 64-bit Windows 7. I am calling my action as follows.

<Control Id="TestConnection" Type="PushButton" X="21" Y="177" Width="100" Height="17" Text="Test Connection">
  <Publish Event="DoAction" Value="TestConnection">1</Publish>
</Control>

推荐答案

根据 DoAction ControlEvent,不能从 ControlEvent 使用 MsiProcessMessage(session.Log 背后的 API).这可以防止您的消息出现在日志中.如果您需要从 ControlEvent 记录一些信息(尤其是用于调试),最好的办法是更改属性值以包含所需的日志信息.

Per the docs on DoAction ControlEvent, MsiProcessMessage (the API behind session.Log) cannot be used from a ControlEvent. This prevents your message from showing up in the log. If you need to log some information from a ControlEvent (especially for debugging), your best bet is a hack like changing a property's value to contain your desired log information.

这篇关于Wix C# 自定义操作日志不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆