简体   繁体   中英

InstallShield Basic MSI System Search does not run for xml file

I am trying to reread a value from an XML file into my Installshield Basic MSI project on upgrades because it always insists on overwriting my XML files modified through xml file changes with default values. When I go to the "System Search" screen, I add a new XML file value via the System Search Wizard. Then I enter the file name of the exe.config file (contents below), I specify the full path to where the file is installed, I enter "/configuration/appSettings/add[@key="UiServiceIpAddress"]" for XPath. I have it search for the value of the attribute "value" and tell it to store the value in a valid property.

When I run this msi, it does not seem to do anything. Upon looking at my MSI log (output below), I can see the AppSearch run, but it does not even mention my xml appsearch. After googling a bit, I figured out how to run a validation on my MSI. There is an error associated with it that reads "Invalid Filename; Table: Signature, Column FileName, Key(s): NewSignature1". The filename appears valid to me. So I am stumped.

Msi log output:

Action start 13:21:48: AppSearch.
AppSearch: Property: IEXPLORE, Signature: IEXPLORE_REG.C8C0673E_50E5_4AC4_817B_C0E4C4466990
MSI (c) (80:B0) [13:21:48:597]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (c) (80:B0) [13:21:48:597]: WIN64DUALFOLDERS: 'C:\Program Files (x86)\' will substitute 17 characters in 'C:\Program Files\Internet Explorer\IEXPLORE.EXE' folder path. (mask argument = 0, the folder pair's iSwapAttrib member = 0).
MSI (c) (80:B0) [13:21:48:597]: PROPERTY CHANGE: Adding IEXPLORE property. Its value is 'C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE'.
AppSearch: Property: DOTNETVERSION40FULL, Signature: DotNet40Full
MSI (c) (80:B0) [13:21:48:597]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (c) (80:B0) [13:21:48:597]: PROPERTY CHANGE: Adding DOTNETVERSION40FULL property. Its value is '#1'.
Action ended 13:21:48: AppSearch. Return value 1.

XML file:

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add value="127.0.0.1" key="UiServiceIpAddress"></add>
    </appSettings>
</configuration>

I suspect that you are using the AppSearch to search for your XML values and assign them to a property using the XPATH notation you gave above.

ICE validation for your MSI shows an improperly formatted file name for your appsettings.xml file. I think all you need to do is provide the shortname (8.3) format for your filename.

Example: FileName=appSettings.xml

FileName columnValue = APPSET~1.XML|appsettings.xml

Phil is correct in stating that MSI itself does not support XML file searches and that InstallShield has added a custom action that manages this for us.

Do a search for 'ISXmlAppSearch' and that will show you the results.

Here is a result from an log file from one of my installers where it does not find the xml file.

Action start 14:09:17: ISXmlAppSearch.
InstallShield 14:09:18: Searching for the contents of the XML Element using the Element '//brand'.
InstallShield 14:09:18: The location of the XML file, stored in the Property 'SYSTEMSETTINGS1', is currently a NULL value.  It appears that the AppSearch did not find the file.
InstallShield 14:09:18: Searching for the contents of the XML Element using the Element '//maincomputer'.
InstallShield 14:09:18: The location of the XML file, stored in the Property 'SYSTEMSETTINGS', is currently a NULL value.  It appears that the AppSearch did not find the file.
MSI (s) (F0:1C) [14:09:18:199]: Doing action: LaunchConditions
Action ended 14:09:18: ISXmlAppSearch. Return value 1.

And here is another showing the results, just so you have an idea of what to expect:

Action start 9:28:24: ISXmlAppSearch.
MSI (s) (D0!0C) [09:28:24:539]: PROPERTY CHANGE: Adding ISMEDFX property. Its value is 'ac'.
InstallShield 9:28:24: Searching for the contents of the XML Element using the Element '//brand'.
InstallShield 9:28:24: Success! The ISXmlAppSearch action set the value of the associated property to the following value: 'ac'.
MSI (s) (D0!0C) [09:28:24:539]: PROPERTY CHANGE: Modifying MAINCOMPUTER property. Its current value is 'YES'. Its new value: 'yes'.
InstallShield 9:28:24: Searching for the contents of the XML Element using the Element '//maincomputer'.
InstallShield 9:28:24: Success! The ISXmlAppSearch action set the value of the associated property to the following value: 'yes'.
MSI (s) (D0!0C) [09:28:24:539]: PROPERTY CHANGE: Adding STORAGELOCATIONROOT property. Its value is 'p:\program files (x86)\amazing charts\'.
InstallShield 9:28:24: Searching for the contents of the XML Element using the Element '//storagelocationroot'.
InstallShield 9:28:24: Success! The ISXmlAppSearch action set the value of the associated property to the following value: 'p:\program files (x86)\amazing charts\'.
MSI (s) (D0:D8) [09:28:24:555]: Skipping action: MedFxSet (condition is false)
MSI (s) (D0:D8) [09:28:24:555]: Doing action: LaunchConditions
Action ended 9:28:24: ISXmlAppSearch. Return value 1.
  • To set this up using the InstallShield wizard, I created a new XML type system search.

    • I specified the filename, in my case SYSTEM~1.XML|systemsettings.xml. NOTE: The wizard gives an invalid file name error if you specify the short name here, you must use direct edit to ensure that you have a valid file name.

    • I set the 'Look In' value to 'A path found in a previous search:' but you can specify anything you want just as long as it is a real path. I think this done before cost initialize so your INSTALLDIR property may not be present, which is why I do an AppSearch for the installation directory and use the option for a previous search.

    • I specified my XPath to XML Element. I remember frustration with this and in the end all I needed to specify is my particular element, particularly if it is unique in the xml file. eg //brand rather than parentelement/brand

    • I selected the 'Look For' option to 'Contents of Element' and then stored the value in a property that I can use later.

To manually modify the file name open Direct Editor. Navigate to the Signature table Find your entry and modify the FileName value.

There is nothing in Windows Installer's AppSearch that will extract a value from an Xml file. There are a couple of explanations:

  1. InstallShield has added the functionality outside of Windows Installer, so there may be an internal custom action that they add to do this, and that would show up somewhere else in your log.

  2. The documentation has somehow got this confused with the IniLocator functionality which will extract a value from a standard INI file (not an Xml file).

As another answer points out, 1. is the reason. Search your log for ISXmlAppSearch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM