I am reading on how to profile Asp.NET core application using NewRelic, and specifically was reading how to use the NewRelic .NET Agent NuGet documentation on this link.
And in that documentation there is something that was a big surprise for me.
So, I am using NuGet package to install the new relic profiling library (the DLL), and will deploy the application to Azure App Service.
In the documentation, they mentioned that we should modify the newrelic.config that comes with the NuGet package.
In the linked doucment check step 4 (Install using NuGet .NET core), and sub step 2 "Modify the log node in newrelic.config
file.
But when we publish the application using dotnet publish
, the NuGet package will be added under subdirectory newrelic
to the publishing folder:bin\release\net8.0\newrelic
.
The article said we need to modify or override the config embedded in the nuget package.
The document mentioned an alternative way using environment variable, which I am going to use because I am not sure how to modify that config file.
But I didn't know you can do that in ASP.NET core?
Can you modify or find a way to override a file that is embedded in a nuget package?
To override a config file or any file, you can add it as content to the project, but it will be deployed to the publish folder
which is bin\release\net8.0
and not to subfolder in that folder.