问题
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