﻿---
title: Set up the APM .NET Agent
description: Overview of the available setup methods for the Elastic APM .NET Agent, including profiler auto instrumentation, NuGet packages, and host startup hooks.
url: https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/set-up-apm-net-agent
products:
  - APM .NET Agent
  - APM Agent
applies_to:
  - Serverless Observability projects: Generally available
  - Elastic Stack: Generally available
  - Application Performance Monitoring Agent for .NET: Generally available
---

# Set up the APM .NET Agent
The .NET agent can be added to an application in three different ways
<definitions>
  <definition term="Profiler runtime instrumentation">
    The agent supports auto instrumentation without any code change and without any recompilation of your projects. See [Profiler Auto instrumentation](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-auto-instrumentation).
  </definition>
  <definition term="NuGet packages">
    The agent ships as a set of [NuGet packages](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/nuget-packages) available on [nuget.org](https://nuget.org). You can add the Agent and specific instrumentations to a .NET application by referencing one or more of these packages and following the package documentation.
  </definition>
  <definition term="Host startup hook">
    On **.NET**, the agent supports auto instrumentation without any code change and without any recompilation of your projects. See [Zero code change setup on .NET](/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-dotnet-net-core#zero-code-change-setup) for more details.
  </definition>
</definitions>

<warning>
  Native AOT is not supported. Refer to [Supported .NET runtimes](/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/supported-technologies#supported-dotnet-runtimes) for details.
</warning>


## Choosing an approach

The three approaches can be used independently or in combination. Use the guidance below to pick the right one for your situation.

| Situation                                                                                                                      | Recommended approach                                                                                                                                                                                                      |
|--------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| No code changes allowed; instrumenting a third-party or legacy application                                                     | Profiler only                                                                                                                                                                                                             |
| Full control over application startup; want explicit, code-level setup                                                         | NuGet packages                                                                                                                                                                                                            |
| .NET Framework application using a technology not in the profiler's IL-rewriting list (for example, Entity Framework 6, Redis) | NuGet package required — the startup hook is not available on .NET Framework                                                                                                                                              |
| Want zero-code-change entry point **and** richer coverage for specific libraries                                               | Profiler + NuGet augmentation — add the relevant integration packages alongside the profiler                                                                                                                              |
| Library already emits native OpenTelemetry spans (for example, `Elastic.Clients.Elasticsearch`, MongoDB Driver ≥3.7)           | Profiler or NuGet provides the [OpenTelemetry Bridge](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/opentelemetry-bridge) automatically — no extra Elastic integration package needed |

For the full breakdown of which technologies are supported by each method, refer to [Supported technologies](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/supported-technologies).

## Get started

- [Profiler Auto instrumentation](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-auto-instrumentation)
- [ASP.NET Core](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-asp-net-core)
- [.NET](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-dotnet-net-core)
- [ASP.NET](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-asp-dot-net)
- [Azure Functions](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-azure-functions)
- [Manual instrumentation](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-general)


## Next: Configure the agent

Once installed, the agent needs to know where to send data. At a minimum you'll need to set your APM Server URL, an authentication credential, and optionally a service name. Refer to [Minimum configuration](/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/configuration#minimum-configuration) for the three settings that every deployment needs.