WiX安装程序:当在初始msi中将web.config设置为NeverOverwrite=yes时,我们可以使用补丁在web.config中添加新元素吗

WiX安装程序:当在初始msi中将web.config设置为NeverOverwrite=yes时,我们可以使用补丁在web.config中添加新元素吗,wix,web-config,Wix,Web Config,我正在开发一个web应用程序。Web.config文件在初始安装时设置为NeverOverwrite(=是)。现在我需要添加DBProviderFactorys,如下所示。我可以在patch.msp中使用XmlFile添加整个块吗?我不想编写自定义操作。我只需要在web.config中添加这个块。这里的任何建议都将不胜感激 <system.data> <DbProviderFactories> <!-- Remove in case this is alread

我正在开发一个web应用程序。Web.config文件在初始安装时设置为NeverOverwrite(=是)。现在我需要添加DBProviderFactorys,如下所示。我可以在patch.msp中使用XmlFile添加整个块吗?我不想编写自定义操作。我只需要在web.config中添加这个块。这里的任何建议都将不胜感激

<system.data>
<DbProviderFactories>
  <!-- Remove in case this is already defined in machine.config -->      
  <remove invariant="Oracle.ManagedDataAccess.Client" />
  <add name="Oracle Data Provider for .NET" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>

示例:可以尝试以下方法:

  • 以下是它的要点-请使用上面的样本进行测试。下面的标记仅用于说明

  • 将XML文件设置为永久永不覆盖

  • 有关测试,请参见上面示例中的内联说明

  • 检查卸载时发生的情况-此标记将删除它添加的条目

    
    

链接

示例:可以尝试以下方法:

  • 以下是它的要点-请使用上面的样本进行测试。下面的标记仅用于说明

  • 将XML文件设置为永久永不覆盖

  • 有关测试,请参见上面示例中的内联说明

  • 检查卸载时发生的情况-此标记将删除它添加的条目

    
    

链接


我还没有尝试。Web.config文件在第一个版本中是否设置为“永久”?如果没有,您可能会在主要升级方案中遇到卸载和重新安装文件的问题。我没有尝试过。Web.config文件在第一个版本中是否设置为“永久”?否则,在主要升级方案中,卸载和重新安装文件可能会出现问题。
    <!-- Set app.config permanent and never overwrite to yes -->
    <Component Feature="ProductFeature" NeverOverwrite="yes" Permanent="yes">
      <File Source="app.config" />
    </Component>

    <!-- The XML update -->

    <!-- Use a NEW GUID here, do not go live with this one -->
    <Component Id="XmlFileUpdate" Guid="{00000000-0000-0000-0000-7405EED51B57}" Feature='ProductFeature'>

      <!--Create New Element-->
      <util:XmlFile Id='XmlSettings1' File='[INSTALLFOLDER]app.config' Action='createElement' Name='MyConfig' ElementPath='//configuration' Sequence='1' />

      <!--Set New Value-->
      <util:XmlFile Id='XmlSettings2' File='[INSTALLFOLDER]app.config' Action='setValue' Name='newVersion' Value='6.6.8' ElementPath='//configuration/MyConfig' Sequence='2' />

      <!--Set New Value-->
      <util:XmlFile Id='XmlSettings3' File='[INSTALLFOLDER]app.config' Action='setValue' Name='Server' Value='Pusevov' ElementPath='//configuration/MyConfig' Sequence='3' />

      <!--Update Existing Value, Existing Element-->
      <util:XmlFile Id='XmlSettings4' File='[INSTALLFOLDER]app.config'
        Action='setValue' Name='newVersion' Value='7.7.7' ElementPath='//configuration/ExistingConfig/bindingRedirect' Sequence='4' />

      <CreateFolder />
    </Component>

  </Directory>
</Directory>