Jimmyt1988
Jimmyt1988

Reputation: 21176

Does the ApplicationInsights.config need to sit in the output directory's root directory

Does the ApplicationInsights.config need to sit in the output directory's (bin folder) root directory, or can i put it inside sub folders in the output directory (bin folder)

<Content Include="Service References\**" Exclude="Service References\Application Insights\ApplicationInsights.config" />
<Content Include="Service References\Application Insights\ApplicationInsights.config">
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

enter image description here

I can't find information on whether that's allowed or not:

https://learn.microsoft.com/en-us/azure/application-insights/app-insights-configuration-with-applicationinsights-config

Upvotes: 2

Views: 597

Answers (2)

Alex
Alex

Reputation: 38529

As you've seen, this is currently the case; It only looks in AppDomain.CurrentDomain.BaseDirectory for ApplicationInsights.config

It's hard-coded for the dotnet framework implementation at least.

Interestingly, the netstandard version returns null for that method.

Upvotes: 1

Jimmyt1988
Jimmyt1988

Reputation: 21176

My colleague in ops has deployed the solution and apparently the ApplicationInsights.config is not picked up unless it's included in the root directory. Hopefully Microsoft will add that to their documentation... Or perhaps allow it to be configured in the future.

Seems odd that it just has to be in the root of the bin folder. *shrugs*

Upvotes: 2

Related Questions