开发者

How to reuse a Wix custom action?

I have been experimenting with Custom Actions in order to encrypt part of the App.Config file on installation (as per how-do-i-encrypt-app-config-file-sections-during-install-with-wix) I have the basic CA process working but I am missing something in my understanding of Wix/msi installations.

My Wix configuration for the CA looks a bit like

<Binary Id="ENCRYPTSECTIO开发者_运维知识库NCADLL" 
            SourceFile="(path to CA DLL)"/>

<Property Id="APPCONFIGPATH" Value="(Path to Exe file)" />
<Property Id="SECTIONTOENCRYPT" Value="(Section of App.Config to Encrypt)" />

<CustomAction Id="ENCRYPT_SECTION"
              BinaryKey="ENCRYPTSECTIONCADLL"
              DllEntry="EncryptConfig"
              Execute="immediate"
              Return="check"
              HideTarget="no"
              Impersonate="no" />

<InstallExecuteSequence>
    <Custom Action="ENCRYPT_SECTION" After="InstallFinalize" />
</InstallExecuteSequence>

And inside the CA are explicit references to

session["APPCONFIGPATH"]
session["SECTIONTOENCRYPT"]

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:

<InstallExecuteSequence>
    <Custom Action="ENCRYPT_SECTION" 
            After="InstallFinalize"
            APPCONFIGPATH = "(Path to Exe File)" 
            SECTIONTOENCRYPT = "(Section #1)" />

    <Custom Action="ENCRYPT_SECTION" 
            After="InstallFinalize"
            APPCONFIGPATH = "(Path to Exe File)" 
            SECTIONTOENCRYPT = "(Section #2)" />

</InstallExecuteSequence>

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.

Can anyone suggest a better way of doing things?

Edit

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


Well after resounding lack of interest by SO I think I found my solution in another SO question: how do i pass msiexec properties to a wix c custom action

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜