PDA

View Full Version : Logging from inside Managed Custom Actions.



fishyj
10-31-2013, 09:35 AM
Hello,

I'm trying to add logging to my managed (C#) custom actions.

The log reports that the custom action is called. But nothing is logged from inside the managed code.

I created a small function to illustrate...



public void TestLogging(int handle, string msg)
{
using (Msi.Install install = Msi.CustomActionHandle(handle))
{
Msi.Record record = new Msi.Record(1);

//record.SetString(0, msg);
record.SetString(0, "Hello World...!");;

install.ProcessMessage(Msi.InstallMessage.Info, record);
}
}


A snippet from the log is shown below.

MSI (c) (98:B0) [14:26:38:656]: Doing action: TestLogging
Action 14:26:38: TestLogging.
Action start 14:26:38: TestLogging.
MSI (c) (98:1C) [14:26:38:665]: Invoking remote custom action. DLL: C:\Users\JASON~1.HAU\AppData\Local\Temp\MSIC2E4.tmp, Entrypoint: m2
Action ended 14:26:39: TestLogging. Return value 1.

Any ideas why my message does not appear?

fishyj
11-01-2013, 07:44 AM
I guess this is not possible. See

http://kb.flexerasoftware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=http--communityflexerasoftwarecom-archive-indexphpt-192340html&sliceId=&docTypeID=DT_MACROVISIONCOMMUNITY_1_1&dialogID=160836749&stateId=0%200%20160832727

Odd how the methods are exposed, but unusable.... :confused:

fishyj
11-01-2013, 11:19 AM
Unless I'm missing something, Managed actions don't fit well with Installshield.:mad:

The suggested work-around, changing a property in the managed custom action in order for the change in value to be logged, does not work for me.....

What am I doing wrong?????

MichaelU
11-04-2013, 11:25 AM
How are you generating your log - namely are you specifying v of /l*v (or of voicewarmup, depending on context)? I believe only verbose logs contain property change information.

Christopher Painter
11-04-2013, 10:17 PM
Logging from managed c# custom actions is easy:


session.Log("Hello World");

You just have to be using the right tools. The tool I'm thinking of is completely compatible with Windows Installer and therefore InstallShield. I don't care who made the tool.... I only care about efficiently making bulletproof installers.