Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using parameters.xml to set parameters on scope different from web.config

We are trying to push a ApplicationInsights key in ApplicationInsights.config via parameters.xml. The parameter does not do his way to the said file.

We build a webdeploy package that is then published to different environnements. All the other parameters are for the web.config and works as expected.

The entry in parameters.xml:

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

The 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>

I am now wondering if it is possible at all to have a scrope differente from "web.config"?

like image 323
Johnny5 Avatar asked Oct 07 '14 13:10

Johnny5


1 Answers

There is a problem whit the xmlns value. Try this:

<parameterEntry kind="XmlFile" scope="ApplicationInsights\.config$"match="/*/*[local-name() = 'InstrumentationKey']/text()"/>
like image 123
LKiss Avatar answered Oct 15 '22 17:10

LKiss