0

我正在尝试使用 WIX (v3.5) 安装程序中的 XmlFile 元素来更新正在安装的 web.config 中的连接字符串。但我收到以下错误。

不是有效的外键;表:XmlFile,列:文件,键:UpdateConnectionString

web.config 组件和文件元素位于使用 Heat 收集的 .wxs 中。这是它在“Site.Components.wxs”中的样子:

        <Component Id="Web.config" Guid="{E66D901B-8140-4162-96F3-8A29253659FE}">
            <File Id="Web.config" KeyPath="yes" Source="$(var.WEBSOURCEFOLDER)\Web.config" />
        </Component>

这是我最近在“Site.Feature.wxs”中使用的组件

<Directory Id="SiteRoot" Name="SiteRoot">
    ...
    <Component Id="WebConfigChanges" Guid="{A242616E-5515-4E77-8CB3-361A449118A4}" >
      <RegistryValue Id="WebConfigChanged" Root="HKLM" Key="SOFTWARE\CompanyName\ProductName" Name="WebConfigChanged" Value="1" Action="write" Type="string" KeyPath="yes" />
      <util:XmlFile Id="UpdateConnectionString"
          File="[#Web.Config]"
          Action="setValue"
          ElementPath="//configuration/connectionStrings/add[\[]@name=’Default’[\]]/@connectionString"
          Value="[CONNNECTIONSTRING]"/>
    </Component>
  </Directory>

以下是我到目前为止使用的一些参考页面:

http://ranjithk.com/2009/11/06/wix-update-application-configuration-files-during-installation/

http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg03256.html

4

1 回答 1

2

MSI 和 WiX 中的 ID 区分大小写。您的 XmlFile 使用 Web.Config,但文件的 id 是 Web.config。

于 2010-12-09T14:03:02.907 回答