[wix-users] how to pass multiple arguments to C# custom action

Lewis Henderson henderso at opentext.com
Fri Apr 29 05:45:29 PDT 2016

Hi Ian,

The property name must match the CustomAction Id, not the DLL entry name.  So, your property should be named " CustomActionId_MyCustomAction ".  Try that out and see if it solves your issue.

				Lewis Henderson
				OpenText, Inc.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Ian Bell
Sent: Friday, April 29, 2016 1:07 AM
To: 'WiX Toolset Users Mailing List' <wix-users at lists.wixtoolset.org>
Subject: [wix-users] how to pass multiple arguments to C# custom action

I am following an example in Nick Ramirez's book Wix 3.6 on how to pass
multiple arguments to a C# custom action.   I can successfully pass a single
argument but not multiple argument.    The end of log file shows
'myDeferredCA' property is correctly defined but
'session.CustomActionData.Values'  is always empty in my custom action.   I
am obviously missing something simple and am hoping someone here can spot my
'hiccup'.   The 'session.CustomActionData.Values' should appear between the
log entries 'Begin myDeferredCA' and 'End myDeferredCA' but the values 'abc123', 'def567' and 'ghi890' never appear between these two log entries.
Can anyone spot what I am doing wrong?

ThanX in advance.


namespace CustomAction1
	public class CustomActions
		public static ActionResult myDeferredCA( Session session )
			session.Log( "Begin myDeferredCA" );

			ICollection<string> values =
			foreach( var value in values ) {
				session.Log( "value = {0}", value );

			session.Log( "End myDeferredCA" );
			return ActionResult.Success;

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Product Id="*" Name="_MySetupProject" Language="1033" Version=""
Manufacturer="MyCompany" UpgradeCode="b0d199cd-d214-4e68-95c0-ecf3aa2d0b0d">
    <Package InstallerVersion="200" Compressed="yes"
InstallScope="perMachine" />
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate EmbedCab="yes"/>

    <Property Id="PROP1" Value="abc123" />
    <Property Id="PROP2" Value="def567" />
    <Property Id="PROP3" Value="ghi890" />
    <CustomAction Id="CustomActionId_SetProperties"
                  Value="Prop1=[PROP1];Prop2=[PROP2];Prop3=[PROP3]" />
    <Binary Id="BinaryId_MyCustomActionsDLL"
.dll" />
    <CustomAction Id="CustomActionId_MyCustomAction"
      <Custom Action="CustomActionId_SetProperties"
Before="CustomActionId_MyCustomAction" />
      <Custom Action="CustomActionId_MyCustomAction"
After="InstallInitialize" />

    <Feature Id="ProductFeature" Title="My Setup Project 01" Level="1">
      <ComponentGroupRef Id="ComponentGroupId_ProgramFilesFolder" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="DirectoryId_ProgramFilesFolder" Name="MyCompany" />

    <ComponentGroup Id="ComponentGroupId_ProgramFilesFolder"
      <Component Id="ComponentId_MyApplication" Guid="*" >
        <File Id="FileId_MyApplication"
Source="$(var.MyApplication.TargetPath)" />


Calling custom action CustomAction1!CustomAction1.CustomActions.myDeferredCA
Begin myDeferredCA
End myDeferredCA
MSI (s) (F0:90) [00:57:42:380]: Executing op:
ActionStart(Name=ProcessComponents,Description=Updating component

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list