[wix-users] Finding XML File to update after installing

Brian Enderle brianke at gmail.com
Mon Sep 14 09:34:21 PDT 2015


I am installing a Web.Config file that I would like to modify with values
obtained during the installation process.

Originally I was manually identifying the files to install like so:

    <ComponentGroup Id="ProductComponents" Directory="INSTALL_FOLDER">
      <Component Id="WebConfig" Win64="yes">
        <File Id="WebConfig"
              Source="$(var.MyProduct.TargetDir)..\Web.config"
              Vital="yes"
              KeyPath="yes"/>
      </Component>
    </ComponentGroup>

I was then updating the XML file like so (which worked correctly):

    <Component Id="UpdateWebConfig"
Guid="{43C4881A-96ED-4361-A5F8-D8B37EEBCFB3}" Directory="INSTALL_FOLDER">
      <CreateFolder />

      <!-- START - Value comes from AcctInfoDlg.wxs -->
      <util:XmlFile Id="UpdateSiteName"
                    Action="setValue"
                    File="[#WEB_CONFIG]"

ElementPath="//configuration/appSettings/add[\[]@key='siteName'[\]]/@value"
                    Value="[SITE_NAME]"
                    Sequence="1" />


I have since switched to using Heat to extract all the files contained in
the $(var.MyProduct.TargetDir) and am no longer able to modify the XML
file.  I know I can no longer use the [#WEB_CONFIG] property that
originally was assigned in the <Component> tag.

The entry for the Web.Config file once extracted via heat looks like:

            <Component Id="cmp67BE95547033126CD732423EE8405F52" Guid="*">
                <File Id="filD7C0321AB7E9E3711DC847528EB85A24"
KeyPath="yes" Source="$(var.PublishedDir)\Web.config" />
            </Component>



I tried adding a property to the installation that would return the
Web.Config file properties like so:

    <Property Id="WEB_CONFIG">
      <DirectorySearch Id="TOOL_PATH" Path="[INSTALL_FOLDER]" Depth="0">
        <FileSearch Id="WEB_CONFIG_FILE" Name="Web.Config" />
      </DirectorySearch>
    </Property>

and then update the Web.Config file, using this property as the location of
the file to update.  However, when I run my installer I get the following
error in the log file:

\bin\,  Size: 42656
MSI (s) (B0:E8) [12:20:15:661]: Executing op: CacheSizeFlush(,)
MSI (s) (B0:E8) [12:20:15:661]: Executing op:
ActionStart(Name=ExecXmlConfig,,)
Action 12:20:15: ExecXmlConfig.
MSI (s) (B0:E8) [12:20:15:661]: Executing op:
CustomActionSchedule(Action=ExecXmlConfig,ActionType=3073,Source=BinaryData,Target=ExecXmlConfig,CustomActionData=2€€3€0€//configuration/appSettings/add[@key='siteName']/€€€asdfg€0)
MSI (s) (B0:18) [12:20:15:661]: Invoking remote custom action. DLL:
C:\WINDOWS\Installer\MSIEE2A.tmp, Entrypoint: ExecXmlConfig
MSI (s) (B0:98) [12:20:15:661]: Generating random cookie.
MSI (s) (B0:98) [12:20:15:677]: Created Custom Action Server with PID 10676
(0x29B4).
MSI (s) (B0:FC) [12:20:15:708]: Running as a service.
MSI (s) (B0:FC) [12:20:15:708]: Hello, I'm your 32bit Elevated Non-remapped
custom action server.
ExecXmlConfig:  Error 0x8007006e: failed to load XML file:
Error 25541. Failed to open XML file , system error: -2147024786

How can I reference a file I just installed in order to update it?



Brian

If you can't explain it simply, you don't understand it well enough.  -
Albert Einstein


More information about the wix-users mailing list