“不是有效的外键” XmlFile 元素错误
我正在尝试使用 WIX (v3.5) 安装程序中的 XmlFile 元素来更新正在安装的 web.config 中的连接字符串。但我发现以下错误。
不是有效的外键;桌子: XmlFile,列:文件,键: 更新连接字符串
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/
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]"/>
</Component>
</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/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MSI 和 WiX 中的 ID 区分大小写。您的 XmlFile 使用 Web.Config,但文件的 id 是 Web.config。
Ids in MSI and WiX are case-sensitive. Your XmlFile uses Web.Config but the file's id is Web.config.