Using .xml parameters to set parameters in a scope other than web.config

We are trying to push the ApplicationInsights key in ApplicationInsights.config

via parameters.xml. The parameter does not match the specified file.

We create a webdeploy package which is then published to different environments. All other options for web.config and work as expected.

Writing to parameters.xml:

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

      

ApplicationInsights.config file:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
  <TelemetryChannel>
    <DeveloperMode>false</DeveloperMode>
  </TelemetryChannel>
  <TelemetryModules>
      [...]
  </TelemetryModules>
  <AccountId></AccountId>
  <InstrumentationKey>HERE GOES THE PARAMETER</InstrumentationKey>
  <ContextInitializers>
      [...]
  </ContextInitializers>
  <TelemetryInitializers>
      [...]
  </TelemetryInitializers>
</ApplicationInsights>

      

Now I'm wondering if it is possible to distinguish scrope from "web.config" at all?

+3


source to share


1 answer


There is a problem with the xmlns value. Try the following:



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

      

+1


source







All Articles