Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reuse a Wix custom action?
    text
    copied!<p>I have been experimenting with Custom Actions in order to encrypt part of the App.Config file on installation (as per <a href="https://stackoverflow.com/questions/306992/how-do-i-encrypt-app-config-file-sections-during-install-with-wix">how-do-i-encrypt-app-config-file-sections-during-install-with-wix</a>) I have the basic CA process working but I am missing something in my understanding of Wix/msi installations.</p> <p>My Wix configuration for the CA looks a bit like </p> <pre><code>&lt;Binary Id="ENCRYPTSECTIONCADLL" SourceFile="(path to CA DLL)"/&gt; &lt;Property Id="APPCONFIGPATH" Value="(Path to Exe file)" /&gt; &lt;Property Id="SECTIONTOENCRYPT" Value="(Section of App.Config to Encrypt)" /&gt; &lt;CustomAction Id="ENCRYPT_SECTION" BinaryKey="ENCRYPTSECTIONCADLL" DllEntry="EncryptConfig" Execute="immediate" Return="check" HideTarget="no" Impersonate="no" /&gt; &lt;InstallExecuteSequence&gt; &lt;Custom Action="ENCRYPT_SECTION" After="InstallFinalize" /&gt; &lt;/InstallExecuteSequence&gt; </code></pre> <p>And inside the CA are explicit references to </p> <pre><code>session["APPCONFIGPATH"] session["SECTIONTOENCRYPT"] </code></pre> <p>Now for my question. What I want to do is to execute my CA twice but supply a different value to the SECTIONTOENCRYPT properties that are fed into it. If I was to invent my own Wix syntax I would express my desires as:</p> <pre><code>&lt;InstallExecuteSequence&gt; &lt;Custom Action="ENCRYPT_SECTION" After="InstallFinalize" APPCONFIGPATH = "(Path to Exe File)" SECTIONTOENCRYPT = "(Section #1)" /&gt; &lt;Custom Action="ENCRYPT_SECTION" After="InstallFinalize" APPCONFIGPATH = "(Path to Exe File)" SECTIONTOENCRYPT = "(Section #2)" /&gt; &lt;/InstallExecuteSequence&gt; </code></pre> <p>I know this is just fancy on my part, but I can't seem to get my head around expressing this in the Wix's declarative format. The only valid idea I can come up with is to concatenate the SECTIONTOENCRYPT strings and parse them out inside the CA. That would work, but it just doesn't feel right to me - although that may be because I don't have any experience in this area.</p> <p>Can anyone suggest a better way of doing things?</p> <p><strong>Edit</strong></p> <p>It just struck me that the main use case of this is when I have a single Wix installer that installs multiple programs in which I want to encrypt the App.Config file</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload