0

Hello I have a dialog with two inputs:

    <Control Id="MyKeyStorePasswordLabel" Type="Text" X="20" Y="105" Width="100" Height="30" NoPrefix="yes" Text="MyKeyStorePassword" />
    <Control Id="MyKeyStorePassword" Type="Edit" X="130" Y="105" Width="200" Height="18" Property="MyKeyStorePassword" Text="MyKeyStorePassword" >
    </Control>

    <Control Id="MyTrustStorePasswordLabel" Type="Text" X="20" Y="125" Width="100" Height="30" NoPrefix="yes" Text="MyTrustStorePassword" />
    <Control Id="MyTrustStorePassword" Type="Edit" X="130" Y="125" Width="200" Height="18" Property="MyTrustStorePassword">
    </Control>

Each of edit fields has its own Property attached. In the wxs file i have that properties defined:

<Property Id="MyKeyStorePassword"/>
<Property Id="MyTrustStorePassword"/> 

and later they are passed to custom action:

<CustomAction Id="DummyCustomAction" BinaryKey="CommonCA" DllEntry="DummyCustomAction" Execute="deferred" Return="check" />
<CustomAction Id="DummyCustomActionProperties" Property="DummyCustomAction" Value="MyKeyStorePassword=[MyKeyStorePassword];MyTrustStorePassword=[MyTrustStorePassword]"/>

In custom action i just read them and write to log:

    public static ActionResult DummyCustomAction(Session session)
    {
        var MyKeyStorePassword = session.CustomActionData["MyKeyStorePassword"];
        var MyTrustStorePassword = session.CustomActionData["MyTrustStorePassword"];
        session.Log($"MyKeyStorePassword is {MyKeyStorePassword} and MyTrustStorePassword is {MyTrustStorePassword}");
        return ActionResult.Success;
    }

But problem is that what ever i put into those edit fields it is ignored. If i change properties definition to:

<Property Id="MyKeyStorePassword" Value="1"/>
<Property Id="MyTrustStorePassword" Value="2"/> 

Then when i run installer those 2 fields are prefiled with values 1 and 2. In the installation log i can see:

MyKeyStorePassword is 1 and MyTrustStorePassword is 2

So passing data to CA works. But if i now try and change those prefilled values 1 and 2 for example to 3 and 4. Still 1 and 2 are being passed. It is looking like some kind of one way binding?

szpic
  • 4,346
  • 15
  • 54
  • 85

1 Answers1

0

You need to capitalize the property names and add the Secure="yes" property to mark them as Secure Custom Public Properties. It's part of MSIs security model.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100