开发者

"Not a valid foreign key" error with XmlFile element

I'm trying to use the XmlFile element in a WIX (v3.5) installer to update the connection string in the web.config that's being installed. But I'm getting the following error in light.

Not a valid foreign key; Table: XmlFile, Column: File, Key(s): UpdateConnectionString

The web.config Component and File elements are located in a .wxs that is harvested using Heat. Here's what it looks like in "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>

Here is the Component I've used most recently in "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]"/>
    </C开发者_开发技巧omponent>
  </Directory>

Here are some reference page that I've used so far:

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


Ids in MSI and WiX are case-sensitive. Your XmlFile uses Web.Config but the file's id is Web.config.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜