[wix-users] Can anyone give me a nice simple example of returning values from a Custom Action?

Paul Mumford paul.mumford at gmail.com
Tue Sep 12 01:04:51 PDT 2017


Hi, been banging my head against the wall on this!

I have a c# custom action to select an option and enter some text, how can
I reference and act on it in the wxs. Really id like to optionally install
different components depending on the select but I can seem to reference
the property returned in session.

Here is a sample:

    <Property Id="THING_INSTALL_TYPE" Value="Default" />

    <Binary Id="THINGSetupCustomActionsDLL"
SourceFile=".\Compiled\THINGSetupCustomActions.CA.dll"
/>
    <CustomAction Id="SelectClientServerID"
BinaryKey="THINGSetupCustomActionsDLL"
DllEntry="SelectClientServer" Execute="immediate" Return="check" />

Will happily run the custom DLL.

In c# I say:

session["THING_INSTALL_TYPE"] = "Client";

Then in the WXS I want to conditionally install components based on the
result, see condition in bold below. I have to do it this way because of
various reasons but it just doesn't seem to return the property back from
the custom action. Any ideas?

            <Component Id='AppComponentID' Guid='xxxxxxxx-3C67-4826-BB16-
82DD9D876B29'>
              <File Id='THINGEXEFileID' Name='THING.exe' DiskId='1'
Source='.\Compiled\THING.exe' KeyPath='yes'>
                <Shortcut Id="startmenuTHINGLink"
Directory="ProgramMenuDir" Name="THINGWorkingDirectory='INSTALLDIR' Icon="
THING.exe" IconIndex="0" Advertise="yes" />
                <Shortcut Id="desktopTHING" Directory="DesktopFolder" Name="
THING" WorkingDirectory='INSTALLDIR' Icon="THINGApp.exe" IconIndex="0"
Advertise="yes" />
              </File>
             * <Condition>**THING_INSTALL_TYPE = "Client"</Condition>*
            </Component>


More information about the wix-users mailing list