1

I'm working with Wix v4 to create a msi package. I had the problem, that I must set a Property in a CustomAction (C#) at the beginning of the installation.

This works fine, but now I'm a little bit confused. The property can't be used in all my cases.

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">

<Property Id="ANUMMER" Value="A2000-0000" />

<Binary Id='CustomActionReadConfig' SourceFile='...'/>

<InstallUISequence>
  <!-- Set the property over session["ANUMMER"] = "..." -->
  <Custom Action="CustomActionReadConfig" Before="AppSearch" />
</InstallUISequence>

The ini file hasn't a problem

    <IniFile Id="Programm.ini" Action="createLine" Key="ANUMMER" Name="Programm.ini" Section="Programm" Value="[ANUMMER]" Directory="Dir" />

For the directory I found the follow workaround

<SetDirectory Action="SetApplicationFolder" Id="APPLICATIONFOLDER" Value="[ProgramFilesFolder]\[COMPANYNAME]\[MYPROGRAMM]\[ANUMMER]"  Sequence="ui"/>

But the shortcuts can' use it and I didn't find a workaround

<Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="Programm [ANUMMER]" WorkingDirectory="Dir" Advertise="yes" Icon="DesktopIcon.exe" IconIndex="0" />
    <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="Programm" WorkingDirectory="Dir" Advertise="yes" Icon="StartMenuIcon.exe" IconIndex="0">
      <ShortcutProperty Key="Name" Value="Programm [ANUMMER]"/>
    </Shortcut>

Like this, I need this property in some further cases. Do I use it wrong or do I have to use an special escape combination? Can't I use properties in Name attributes? Is there an other way, to use the input as variable witch I can set in the CustomAction? Or what is the basic problem, that I can't use such a custom runtime property in sutch ways?

Thanks for help

RCP161
  • 199
  • 1
  • 13
  • Try setting your property as `Secure="yes"` – Brian Sutherland Aug 31 '17 at 17:05
  • Thanks, but it dosen't help. This attribute of [property](http://wixtoolset.org/documentation/manual/v3/xsd/wix/property.html) is for server actions – RCP161 Sep 01 '17 at 06:23
  • @RPC161: quoting the documentation doesn't make Brian wrong. He's correct. The "server" part here is because a Windows Installer install has a client process and a server process, and unless Secure is set the public properties will not transfer from the client UI/inititialization process into the actual install process. So Secure must be set true, even if it's not your immediate issue. – PhilDW Sep 02 '17 at 16:24
  • Ok, thanks for explanation – RCP161 Sep 04 '17 at 05:45

1 Answers1

0

After searching for further options I found the reason for the problem for this in an other question here: Dynamically assigning name to shortcut at run time in WIX

The property value can be used in Formatted type. I wanted to use it in LongFileNameType (Simple Type) or in strings.

If someone knows a way, to fill a variable at runtime to solve this problem, it would be nice to share it with us.

Info: The value could also be a localization variable with the format !(loc.VARIABLE).

RCP161
  • 199
  • 1
  • 13