【问题标题】:InstallShield Basic MSI System Search does not run for xml fileInstallShield Basic MSI 系统搜索不会针对 xml 文件运行
【发布时间】:2016-10-17 18:07:01
【问题描述】:

我试图在升级时将 XML 文件中的值重新读取到我的 Installshield Basic MSI 项目中,因为它总是坚持用默认值覆盖我通过 xml 文件更改修改的 XML 文件。当我进入“系统搜索”屏幕时,我通过系统搜索向导添加了一个新的 XML 文件值。然后我输入 exe.config 文件的文件名(内容如下),我指定文件安装位置的完整路径,我为 XPath 输入“/configuration/appSettings/add[@key="UiServiceIpAddress"]”。我让它搜索属性“value”的值并告诉它将该值存储在一个有效的属性中。

当我运行这个 msi 时,它似乎没有做任何事情。查看我的 MSI 日志(下面的输出)后,我可以看到 AppSearch 正在运行,但它甚至没有提到我的 xml appsearch。谷歌搜索了一下后,我想出了如何在我的 MSI 上运行验证。有一个与之相关的错误,显示为“无效的文件名;表:签名,列文件名,密钥:NewSignature1”。文件名对我来说似乎有效。所以我被难住了。

Msi 日志输出:

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 文件:

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

【问题讨论】:

    标签: xml windows-installer installshield


    【解决方案1】:

    我怀疑您正在使用 AppSearch 来搜索您的 XML 值并使用您在上面给出的 XPATH 表示法将它们分配给一个属性。

    您的 MSI 的 ICE 验证显示您的 appsettings.xml 文件的文件名格式不正确。我认为您需要做的就是为您的文件名提供短名称(8.3)格式。

    示例:文件名=appSettings.xml

    文件名列值 = APPSET~1.XML|appsettings.xml

    Phil 正确地指出 MSI 本身不支持 XML 文件搜索,并且 InstallShield 添加了一个自定义操作来为我们管理此操作。

    搜索 'ISXmlAppSearch' 会显示结果。

    这是我的一个安装程序的日志文件的结果,它没有找到 xml 文件。

    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.
    

    这是另一个显示结果,只是为了让您知道会发生什么:

    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.
    
    • 为了使用 InstallShield 向导进行设置,我创建了一个新的 XML 类型系统搜索。

      • 我指定了文件名,在我的例子中是 SYSTEM~1.XML|systemsettings.xml。 注意:如果您在此处指定短名称,向导会给出无效的文件名错误,您必须使用直接编辑来确保您有一个有效的文件名。

      • 我将“查找范围”值设置为“在先前搜索中找到的路径:”但您可以指定任何您想要的内容,只要它是真实路径即可。我认为这是在成本初始化之前完成的,因此您的 INSTALLDIR 属性可能不存在,这就是我为安装目录执行 AppSearch 并使用先前搜索选项的原因。

      • 我将我的 XPath 指定为 XML 元素。我记得对此感到沮丧,最后我只需要指定我的特定元素,特别是如果它在 xml 文件中是唯一的。例如//品牌而不是父元素/品牌

      • 我选择了“元素内容”的“查找”选项,然后将该值存储在一个属性中,以便以后使用。

    要手动修改文件名,请打开直接编辑器。 导航到签名表 找到您的条目并修改 FileName 值。

    【讨论】:

      【解决方案2】:

      Windows Installer 的 AppSearch 中没有任何内容可以从 Xml 文件中提取值。有两种解释:

      1. InstallShield 已在 Windows Installer 之外添加了该功能,因此他们可能会添加一个内部自定义操作来执行此操作,并且该操作会显示在您的日志中的其他位置。

      2. 文档不知何故将此与 IniLocator 功能混淆了,后者将从标准 INI 文件(不是 Xml 文件)中提取值。

      正如另一个答案指出的那样,1. 是原因。在您的日志中搜索 ISXmlAppSearch。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-10-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多