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>
Squarespace features a better blogging tool than Wix and offers excellent support. The main difference between Wix and Squarespace is ease of use. Wix is slightly more beginner-friendly, especially since they also offer Wix ADI, which is a separate editor, targeted at beginners.
PRO TIP: No, Wix is not owned by Google. Wix is an online platform that allows users to create their own websites. While it is not owned by Google, the company has a close relationship with the search giant, and Wix is one of Google's official web creation tools.
Squarespace is an all-in-one content management system, or CMS. With a single subscription, you can make a website, host your content, register your own custom domain name, sell products, track your site's analytics, and much more.
Wix.com Ltd. קום) is an Israeli software company, publicly listed in the US, that provides cloud-based web development services. It allows users to create HTML5 websites and mobile sites through the use of online drag and drop tools.
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.
I got around this by using the unmanaged OutputDebugString:
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern void OutputDebugString(string message);
public bool IsDebugLogging { get; set; }
public void Log(string message)
{
// Uncomment if you have access to the Session object passed into your custom action.
// Session.Log(message);
if (IsDebugLogging)
{
OutputDebugString(message);
}
}
In my custom action, I set IsDebugLogging = true to enable OutputDebugString logging. This output can be viewed using Sysinternal's DebugView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With