This document explains how to install the .NET agent using NuGet.
Install agent using NuGet
The NewRelic.Agent NuGet package places the New Relic agent in your application's build output directory so that the agent gets deployed with your application.
Before installing the agent using NuGet, understand these important points:
- In order to configure environment variables and directory permissions, you must have access to the systems where you are deploying your applications.
- If you're using NuGet to update an existing .NET agent, this will overwrite previously made changes to
newrelic.config. To preserve changes, first save the config file outside of your project, then restore it after updating.
logs folder gets created as a subfolder of the
newrelic folder in your application's build/publish output directory. The
logs folder gets created with default permissions, meaning that it may not be writable by the agent if your app is run by a different user than the user who built/published the app. Make sure that the user your app runs as can write to the
Here's an example of using NuGet via Visual Studio to install the .NET agent:
Open your Visual Studio solution, or create a new one by selecting File > New > Project. For multi-project solutions, be sure to select the correct project (for example, a specific website project).
Open the Package Manager console by selecting Tools > Library Package Manager > Package Manager Console. Set your project as the default project.
From the Package Manager command prompt, type
Install-Package NewRelic.Agentand press Enter. When you build your project, the .NET agent folder will be copied to your build output directory.
Set environment variables (below) and any other necessary configuration. How to do this will vary, depending on your environment and system.
For more details on these variables, as well as correct values for other installation scenarios, please see understanding .NET agent environment variables.
If your application is receiving traffic, data should appear within a few minutes. If it doesn't, see No data appears.