Visual studio 使用parameters.xml在不同于web.config的作用域上设置参数

Visual studio 使用parameters.xml在不同于web.config的作用域上设置参数,visual-studio,webdeploy,Visual Studio,Webdeploy,我们正试图通过parameters.xml将ApplicationInsights键推入ApplicationInsights.config。 该参数不符合所述文件的要求 我们构建了一个webdeploy包,然后发布到不同的环境中。所有其他参数都适用于web.config,并按预期工作 parameters.xml中的条目: <parameter name="InsightInstrumentationKey" description="InsightInstrumentationK

我们正试图通过parameters.xml将ApplicationInsights键推入
ApplicationInsights.config
。 该参数不符合所述文件的要求

我们构建了一个webdeploy包,然后发布到不同的环境中。所有其他参数都适用于web.config,并按预期工作

parameters.xml中的条目:

   <parameter name="InsightInstrumentationKey" description="InsightInstrumentationKey">
      <parameterValidation kind="AllowEmpty" />
      <parameterEntry kind="XmlFile"
                      scope="\\ApplicationInsights.config$"
                      match="/ApplicationInsights/InstrumentationKey/text()" />
   </parameter>

ApplicationInsights.config文件:


假的
[...]
这里是参数
[...]
[...]

我现在想知道是否有可能将scrope与“web.config”区别开来?

xmlns值存在问题。试试这个:

<parameterEntry kind="XmlFile" scope="ApplicationInsights\.config$"match="/*/*[local-name() = 'InstrumentationKey']/text()"/>

这是我发现的唯一有效的解决方案。
<parameterEntry kind="XmlFile" scope="ApplicationInsights\.config$"match="/*/*[local-name() = 'InstrumentationKey']/text()"/>