# How to enable Elastic APM for c# console application

**URL:** <https://discuss.elastic.co/t/how-to-enable-elastic-apm-for-c-console-application/303754>\
**Category:** APM\
**Created:** [May 2, 2022, 2:22pm UTC](https://discuss.elastic.co/t/how-to-enable-elastic-apm-for-c-console-application/303754 "2022-05-02T14:22:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sachin\_Agarwal2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sachin_agarwal2/32/105132_2.png) [@Sachin\_Agarwal2](https://discuss.elastic.co/u/Sachin_Agarwal2)\
**Post date:** [May 2, 2022, 2:22pm UTC](https://discuss.elastic.co/t/how-to-enable-elastic-apm-for-c-console-application/303754/1 "2022-05-02T14:22:35Z")

</div>

How can we use elastic APM for the C# console application, for ast .net core we can do it using ```  
app.UseAllElasticApm(Configuration) but for console app we cant access app instance .

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 2, 2022, 3:49pm UTC](https://discuss.elastic.co/t/how-to-enable-elastic-apm-for-c-console-application/303754/2 "2022-05-02T15:49:17Z")

</div>

Have you seen the profilter auto instrumentation? See [Profiler Auto instrumentation | APM .NET Agent Reference [1.12] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/setup-auto-instrumentation.html)

---

<div class="post-metadata">

**Author:** ![Sachin\_Agarwal2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sachin_agarwal2/32/105132_2.png) [@Sachin\_Agarwal2](https://discuss.elastic.co/u/Sachin_Agarwal2)\
**Post date:** [May 3, 2022, 7:20am UTC](https://discuss.elastic.co/t/how-to-enable-elastic-apm-for-c-console-application/303754/3 "2022-05-03T07:20:21Z")

</div>

I am using .net Core Console application and tried this but I cant find any tracing after applying suggested changes like below ..

1. Download the `elastic_apm_profiler_<version>.zip` file from the [Releases](https://github.com/elastic/apm-agent-dotnet/releases) page of the .NET APM Agent GitHub repository, where `<version>` is the version number to download. You can find the file under Assets.
2. Unzip the zip file into a folder on the host that is hosting the application to instrument.
3. Configure the following environment variables  
set CORECLR\_ENABLE\_PROFILING = "1"  
set CORECLR\_PROFILER = "{FA65FE15-F085-4681-9B20-95E04F6C03CC}"  
set CORECLR\_PROFILER\_PATH = "\elastic\_apm\_profiler.dll"  
set ELASTIC\_APM\_PROFILER\_HOME = ""  
set ELASTIC\_APM\_PROFILER\_INTEGRATIONS = "\integrations.yml"

---

<div class="post-metadata">

**Author:** ![Sachin\_Agarwal2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sachin_agarwal2/32/105132_2.png) [@Sachin\_Agarwal2](https://discuss.elastic.co/u/Sachin_Agarwal2)\
**Post date:** [May 5, 2022, 7:04am UTC](https://discuss.elastic.co/t/how-to-enable-elastic-apm-for-c-console-application/303754/4 "2022-05-05T07:04:18Z")

</div>

@spinscale can u help on this?

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [May 10, 2022, 10:06am UTC](https://discuss.elastic.co/t/how-to-enable-elastic-apm-for-c-console-application/303754/5 "2022-05-10T10:06:13Z")

</div>

Hi @Sachin_Agarwal2

for a console app, the best way to go will be to use manual code instrumentation. So you won't be able to just add the agent with a single line and see transactions automatically. This is because it's hard to automatically know what a transaction is in a console app - in a web app it's very well defined: it's a web request, but a console app can do anything, so the agent won't start a transaction automatically.

[Here is the documentation](https://www.elastic.co/guide/en/apm/agent/dotnet/current/public-api.html) on how the public API of the agent works. With that you can start your transactions and capture spans manually.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 7, 2022, 10:06am UTC](https://discuss.elastic.co/t/how-to-enable-elastic-apm-for-c-console-application/303754/6 "2022-06-07T10:06:30Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
