Failed to open XML File error on updating config during msi upgrade

0

So I have a wix installer which runs fine on fresh install but when I upgrade from previous version to this new version where I am changing the config value, I get the following error and the installer rolls back:

ExecXmlFile: Configuring Xml File: ExecXmlFile: Error 0x8007006e: failed to load XML file: Error 25531. Failed to open XML file , system error: -2147024786 MSI (s) (2C:5C) [14:45:21:281]: Product: MyProduct -- Error 25531. Failed to open XML file , system error: -2147024786 CustomAction ExecXmlFile returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox) Action ended 14:45:21: InstallExecute. Return value 3.

Here is my xml file where I want to change from 4.5 to 4.6.2

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>  
  </appSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup>
  <runtime>
    ...
  </runtime>
</configuration>

And here is my corresponding wix change

  <!--XML config file upgrade change-->
    <Component Id="ServiceConfigUpgrades" Guid="{guid3}">
                      <Condition><![CDATA[(INSTALLDIR <> "") AND NOT REMOVE]]></Condition>
                      <CreateFolder />
                      <util:XmlFile Id="UpdateServiceVersion"
                        File="[#fil2]"
                        Action="setValue"
                        Name="sku"
                        Value=".NETFramework,Version=v4.6.2"                  
                        ElementPath="configuration/startup/supportedRuntime" />
    </Component>

Could this be issue related to my element path? Note that the <startup><suuportedRuntime> is in same line. Not sure if this matters but any help will be great.

Found this observation, maybe I am wrong but could you tell me what will be the ElementPath of sku below to change its value if the xml path is like this, where startup and supportedRuntime tags are in one line:

<configuration>
    <startup><supportedRuntime version="v4.0" sku=".NetFramework,Version=v4.6.2"/></startup>
</configuration>
xml
wix
web-config
windows-installer
asked on Stack Overflow Sep 28, 2017 by Atihska • edited Oct 3, 2017 by Atihska

3 Answers

1

I haven't used this approach, but there are three things that stand out to me:

  1. Error 0x8007006e (also -2147024786) appear to come down to error 110:

    The system cannot open the device or file specified

  2. The first line you quote says

    ExecXmlFile: Configuring Xml File:

    but does not list a file name after the colon. The second line is similar.

  3. The third and fourth lines have a space between file and a comma.

    Failed to open XML file , system error: -2147024786

    All four of these cases look like they should tell us the name of the file it's trying to open. One or even two of them being a typo or misinterpretation is plausible, but all three tells me it's not getting your filename.

So, assuming that's the case, what's wrong? You've configured it to reference a file key (File="[#fil2]") which seems like it should work....if your file's key is actually fil2, and the rest of the restrictions on Formatted (Windows) have been followed. Verify first the file key, the installation state of its component, and the sequencing of the action respective to costing.

If a substring of the form [#filekey] is found, it is replaced by the full path of the file, with the value filekey used as a key into the File table. The value of [#filekey] remains blank and is not replaced by a path until the installer runs the CostInitialize action, FileCost action, and CostFinalize action. The value of [#filekey] depends upon the installation state of the component to which the file belongs. If the component is run from the source, the value is the path to the source location of the file. If the component is run locally, the value is the path to the target location of the file after installation. If the component has an action state of absent, the installed state of the component is used to determine the [#filekey] value. If the installed state of the component is also absent or null, [#filekey] resolves to an empty string, otherwise it resolves to the value based upon the component's installed state. For more information about checking the installation state of components, see Checking the Installation of Features, Components, Files.

If that doesn't help, examples such as those in this WiX tutorial do use formatted strings in File, but reference paths such as [INSTALLDIR]settings.xml. Perhaps you should try [INSTALLDIR]config.xml or similar.

(Or, at the very least, put in some hardcoded File value and see if the log lines confirm my suspicion.)

answered on Stack Overflow Sep 28, 2017 by Michael Urman
0

I faced with the same problem, and resolve it by this way

</Component>
      <Component Id="ChangeConfig" Guid="b11556a2-e066-4393-af5c-9c9210187eb3">
        <File Id='Config' DiskId='1' Name="app.config" Vital="yes" KeyPath="yes" Source='$(sys.CURRENTDIR)\app.config'/>
      <util:XmlFile Id="AppConfigSetConnStr" Action="setValue" Permanent="yes" File="[INSTALLLOCATION]app.config"            
                    ElementPath="configuration/startup/installationPath" Name="path" 
                    Value="[INSTALLLOCATION]" />
      </Component>

hope it will help you.

answered on Stack Overflow Aug 6, 2019 by giacomo12312213132
0

I got the same error with the same number because I incorrectly referenced a File Id in the .wxs file. Case sensitivity is important here!

That fails:

<File Id="WEBSERVICE.XML" Name="WebService.xml" Source="WebService.xml" />
<util:XmlFile Id="UpdateAppDir" File="[#WebService.xml]" ... />

That works:

<File Id="WEBSERVICE.XML" Name="WebService.xml" Source="WebService.xml" />
<util:XmlFile Id="UpdateAppDir" File="[#WEBSERVICE.XML]" ... />
answered on Stack Overflow Mar 3, 2021 by Sven Döring

User contributions licensed under CC BY-SA 3.0