azure-application-insights

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


Solution

  • 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.