Custom Action to set INSTALLFOLDER path

224 Views Asked by At

So I created this customAction that gets me the path of another app using Registries

string value = Registry.GetValue(userRoot, key, -1).ToString();
session["INSTALLLOCATION"] = value; 

And it works. The problem is how I send it back to the .wxs file and set the installation path of something to be that string value. I have this thing in the Wix file:


    <CustomAction Id="CustomAction" Property="CustomAction2" Value="path=[INSTALLLOCATION]" />
    
    <Binary Id="CustomActionBinary" SourceFile="$(var.ProAdmin_TargetDir)ExtractRegistryPath\bin\Debug\ExtractRegistryPath.CA.dll"/>
    <CustomAction Id="CustomAction2" Impersonate="no" BinaryKey="CustomActionBinary" DllEntry="CustomAction1" Return="check" Execute="deferred"/>

<InstallUISequence>
      <Custom Action="CustomAction" Before="CustomAction2" />
      <Custom Action='CustomAction2' Before="ExecuteAction" />
    </InstallUISequence>

This thing throws an 2762 error code.

1

There are 1 best solutions below

0
jbudreau On

You're getting error 2762 because you can't have deferred actions in the InstallUISequence. The custom action that populates the INSTALLLOCATION property should be called at the beginning of both the InstallUISequence and InstallExecuteSequence as an 'immediate' action - and - INSTALLLOCATION should be a folder in the Directory table.