Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX CustomAction - how to get more info in install/log

Someone told me there was a way for the CustomAction in WIX to display the output in the console log. I'm including an .exe called XmlPreprocess.exe to manipulate my web.config, based on parms in a file called SettingsFileGenerator.xml,

I'm running like this: msiexec /i bin\Debug\TFBIC.RCT.WCFWebServicesWIXSetup.msi /L*V "C:\logs\WixInstall01.log"

This is my WIX build file:

 <CustomAction Id="**SAMPLE_CONFIG**" BinaryKey="XMLPREPROCESS" ExeCommand="/i:&quot;[INSTALLLOCATION]web.config&quot; /x:&quot;[INSTALLLOCATION]SettingsFileGenerator.xml&quot; /e:QA /d:ServiceLocation=[SERVICELOCATION]" Execute="deferred" />
    <Binary Id="XMLPREPROCESS" SourceFile="../TFBIC.RCT.WCFWebServices/RequiredBins/XMLPreprocess.exe" />
    <InstallExecuteSequence>
        <Custom Action="SAMPLE_CONFIG" After="StartServices"><![CDATA[NOT Installed]]></Custom>
    </InstallExecuteSequence>

Install log shows this:

Action 15:22:27: StartServices. Starting services
Action start 15:22:27: StartServices.
MSI (s) (58:CC) [15:22:27:898]: Note: 1: 2205 2:  3: ServiceControl
MSI (s) (58:CC) [15:22:27:898]: Note: 1: 2228 2:  3: ServiceControl 4: SELECT `Name`,`Wait`,`Arguments`,`Event`, `Action` FROM `ServiceControl`, `Component` WHERE `Component_` = `Component` AND (`Action` = 0 OR `Action` = 1 OR `Action` = 2)
Action ended 15:22:27: StartServices. Return value 1.
MSI (s) (58:CC) [15:22:27:899]: Doing action: SAMPLE_CONFIG
Action 15:22:27: SAMPLE_CONFIG.
Action start 15:22:27: **SAMPLE_CONFIG**.
SAMPLE_CONFIG:
Action ended 15:22:27: **SAMPLE_CONFIG**. Return value 1.

This is my very first attempt to do WIX, so please bear with my ignorance.

Thanks

UPDATE:

This is a quote from another forum - but he doesn't specify how it works and he doesn't seem to check back often.

WiX has a custom action that captures the console output and sticks it directly into the verbose MSI log, so that's what I use.

reference: http://xmlpreprocess.codeplex.com/Thread/View.aspx?ThreadId=79454

Would this be the tool he is talking about? http://wix.sourceforge.net/manual-wix2/qtexec.htm I get this error when trying it: error LGHT0103: The system cannot find the file 'wixca.dll'. I have searched entire disk for this .dll and could not find it.

like image 599
NealWalters Avatar asked Jan 12 '10 21:01

NealWalters


2 Answers

To enable all possible logging while installing an msi, use the /lvx* logfile.txt option. However, even this will not log the STDOUT and STDERR output of command line applications invoked as a custom action.

If you have written the custom action yourself, you can add such logging to it. For example, the DTF libraries that come with wix have a handy Session.Log method that you can call. See c:\program files\windows installer xml v3\doc\dtf.chm, topic "Writing Managed Custom Actions" for more information.

If you have not written the application, you could write a custom action to wrap it. Such a wrapper could use the .NET Process class to invoke an executable, read the StandardError and StandardOutput streams, and log everything with the Session.Log method mentioned above.

edit: I don't know of any standard custom action in wix that sends console output to the log. Try the wix-users mailing list.

like image 121
Wim Coenen Avatar answered Nov 11 '22 00:11

Wim Coenen


In Wix 3.10 you can use the Quiet Execution custom action to run an executable (silently, e.g. without a command window popup), and the console output will end up in the msi log.

As mentioned, you need the WixUtilExtension reference to get access to this feature.

like image 35
dennis_vok Avatar answered Nov 11 '22 00:11

dennis_vok