rabin
rabin

Reputation: 471

Wix: path to binary file in CustomAction

I have the following code in my wxs file

<Directory Id="TempFolder" Name="Temp">
    <Component Id="TempExes" Guid="DF92ED79-28AB-4E88-81F2-8B035D4B8A01" DiskId="1">
          <File Id="CACLS_EXE" Name="CACLS.EXE" Source="Binary\CALCS.EXE" />
    </Component>
</Directory>

Now when I call a Custom Action from the installer, how do I get the path to this exe? I tried

var pathToExe = session.GetTargetPath("TempFolder") + "CACLS.exe"

which doesn't work. Any ideas? Thanks.

Upvotes: 2

Views: 3287

Answers (2)

scott
scott

Reputation: 3081

Did you try:

<Directory Id="TEMPFOLDER" Name="Temp">
    <Component Id="TempExes" Guid="DF92ED79-28AB-4E88-81F2-8B035D4B8A01" DiskId="1">
      <File Id="CACLS_EXE" Name="CACLS.EXE" Source="Binary\CALCS.EXE" />
    </Component>
</Directory>

and

var pathToExe = session.GetTargetPath("TEMPFOLDER") + "CACLS.exe"

public properties are in all caps.

I haven't used wix in a while but if i remember correctly, if your custom action is scheduled to run during the part of the installation where changes are made to the system you have to use a special property if you want to be able to access the information.

Upvotes: 1

Christopher Painter
Christopher Painter

Reputation: 55620

Why are you even going out of process with a custom action to use CACLS in the first place? WiX / MSI already has built in permissions manipulation functionality. Stay declarative not imperative and the quality of your installer will improve greatly while saving you time by not reinventing the wheel.

Upvotes: 1

Related Questions