Search code examples
wixwix3.5custom-action

When can I get the target directories in a WIX installer?


So I have a custom action

          <CustomAction Id="GetTarget"
                BinaryKey="CA"
                DllEntry="GetTargetPath"
                Execute="immediate"
                Return="check"
                HideTarget="no"
                Impersonate="no" />

  <InstallExecuteSequence>
     <Custom Action="GetTarget" After="CostFinalize">(NOT REMOVE = "ALL")</Custom>
  </InstallExecuteSequence>

This is calling a DLL that calls the method session.GetTargetPath("TARGETPATH"); But I get an exception "The directory name is invalid. TARGETPATH". I have the custom action as After="CostFinalize" as this is what I read from a source (which I can provide) but I think there is a mistake and I think that I just have to to execute the action at the right time.


Solution

  • I think you meant TARGETDIR. Take a look at http://msdn.microsoft.com/en-us/library/windows/desktop/aa371685(v=vs.85).aspx