MSI日志调试日志接收器 [英] MSI Log Debug Log Sink

查看:133
本文介绍了MSI日志调试日志接收器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个InstallShield MSI项目.当我将MSIHANDLE从InstallScript定制操作传递给通过DotNetCoCreateObject()初始化的托管程序集时,在托管代码中收到的值为-2.

I have an InstallShield MSI project. When I pass an MSIHANDLE from an InstallScript custom action to a managed assembly initialized via DotNetCoCreateObject(), the value received within my managed code is -2.

有人知道是否可以通过通过DotNetCoCreateObject()调用托管代码的InstallScript自定义操作来访问MSIHANDLE?我想将我的自定义操作结果记录到与其余安装相同的日志文件中.我正在使用InstallShield 2010,Windows Install 4.5和.Net 3.5.

Does anyone know if it is possible to access an MSIHANDLE from an InstallScript custom action that calls into managed code via DotNetCoCreateObject()? I'd like to log my custom action results to the same log file as the rest of the installation. I am using InstallShield 2010, Windows Install 4.5 and .Net 3.5.

推荐答案

只能通过托管的自定义操作进行操作,并且需要使用InstallShield的InstallShield.Interop.Msi.dll才能获取实际的句柄.

It is only possible via a managed custom action and requires use of InstallShield's InstallShield.Interop.Msi.dll to get at the actual handle.

要通过托管的自定义操作写入MSI日志文件,请执行以下操作:

To write to the MSI log file from a managed custom action, this works:

 using (Msi.Install msi = Msi.CustomActionHandle(_msiHandle))
 {
     using (Msi.Record record = new Msi.Record(100))
     {
         record.SetString(0, "LOG: [1]");
         record.SetString(1, entry.Message);
         msi.ProcessMessage(Msi.InstallMessage.Info, record);
     }
 }

注意::从IS2010开始,InstallShield.Interop.Msi.dll尚未进行数字签名,因此具有托管自定义操作的程序集也必须未签名.

NOTE: As of IS2010, InstallShield.Interop.Msi.dll is not digitally signed, so the assembly with your managed custom action must also be unsigned.

这篇关于MSI日志调试日志接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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