In wix, using vbscript, how do I write to the log file?

只谈情不闲聊 提交于 2020-03-03 07:33:28

问题


I am trying the following inside a customaction:

Session.Log("GetOfficeBitness =" & Session.Property("OfficeBitness"))

And I am getting the error:

Error 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action GetOfficeBitness script error -2146827850, Microsoft VBScript runtime error: Object doesn't support this property or method: 'Session.Log' Line 39, Column 9, MSI (c) (FC:94) [05:51:13:621]: Product: Windward Report Designer 32-bit -- Error 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action GetOfficeBitness script error -2146827850, Microsoft VBScript runtime error: Object doesn't support this property or method: 'Session.Log' Line 39, Column 9,

How can I write to the log inside my script?


回答1:


Logging: Please try to read Robert Dickau's MSI Tip: Writing to the Log File from a Custom Action. In essence something like this:

option explicit
dim inst, rec
set inst = CreateObject("WindowsInstaller.Installer")
set rec=inst.CreateRecord (2)
rec.StringData(1) = "Logging call from " & property("CustomActionData")
Session.Message &H04000000, rec

WiX Sample: I just remembered that I put a sample for this on github: https://github.com/glytzhkof/all (try the zip maybe, easier to download - there is a folder and an equivalent zip archive).

Sample: VBScriptWriteToLog.


Tip: Here is a bunch of WiX / MSI links on all kinds of topics centering around debugging.


Links:

  • Enable installation logs for MSI installer without any command line arguments (about MSI logging in general)
  • Windows Installer Deferred execution - how can we log the custom actions running in deferred mode?


来源:https://stackoverflow.com/questions/60362396/in-wix-using-vbscript-how-do-i-write-to-the-log-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!