Wix C# Custom Action Logging Not Working

wix

Solution

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.

Problem

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 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. 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> ```

Original source