【问题标题】:Unable to find xml node wix spath找不到 xml 节点 wix spath
【发布时间】:2017-05-05 20:48:34
【问题描述】:
I am trying to update the web.config file while the installation process using the wix toolset 3.11. I am getting the error that xml node is not found while running the installer. I have tried this with xmlfile as well with xmlconfig with no success. Please help me in resolving this.

“在 wb.config xml 文件中找不到节点://configuration/connectionStrings/add[@name='mydb”]。”

下面是xml文件:

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="MYNAME" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SOMEDB;Data Source=SOMEHOST"
providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

Below is my code 

     <Component Id="cmpWebConfig" Guid="635F6999-89B4-42FF-89AC-9E2A710B42F8">
        <File Id="WEBCONFIG" Source="Web.Config" Name="Web.Config" KeyPath="yes"/>
        <!--<util:XmlConfig Id="setConnString" File="[INSTALLFOLDER]Web.config" Action="create" On="install" Node="value" Name="connectionString" Value="Data Source=[DB_INSTANCE]; Initial Catalog=Customers;Integrated Security=SSPI" ElementPath="//configuration/connectionStrings/add[\[]@name='mydb'[\]]" Sequence="1" />-->
        <util:XmlFile Id="ModifyConnectionString"
 Action="setValue"
 Permanent="yes"
 ElementPath="//configuration/connectionStrings/add[\[]@name='MYNAME'[\]]"
 Name="connectionString"
 File="[#WEBCONFIG]"
 Value="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=mydb;Data Source=[SQLHOST]"
 SelectionLanguage="XPath"
 Sequence="1" />
      </Component>

【问题讨论】:

  • 您的 xml 文件中没有
  • 更新值后,我也出现安装程序运行时节点不存在的相同错误。

标签: xml wix wix3.11


【解决方案1】:

这将解决您的问题。

删除元素路径前多余的斜线。

只需复制并粘贴它并更改值

<util:XmlFile Id="ModifyConnectionString"
                     Action="setValue"
                     Permanent="yes"
                     ElementPath="/configuration/connectionStrings/add[\[]@name='MigratorDB'[\]]"
                     Name="connectionString"
                     File="[INSTALLFOLDER]web.config"
                     Value='Data Source=[DB_SERVER]; Initial Catalog=[DB_DATABASE]; User Id=[MMDB_USER]; Password=[MMDB_PASSWORD];'
                     SelectionLanguage="XSLPattern"
                     Sequence="1" />

【讨论】:

    猜你喜欢
    • 2012-11-27
    • 1970-01-01
    • 2016-04-13
    • 1970-01-01
    • 2019-08-10
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    • 2023-03-14
    相关资源
    最近更新 更多