I'm trying to get the processid so I can attach the dotnet core console application to the right process to debug in Visual Studio 2019:
I used the following code in the progress.cs
. This code displays a processid but the processid is not listed in the number of dotnet process in Visual Studio 2019.
var currentProcess = Process.GetCurrentProcess();
Console.WriteLine($"ProcessId: {currentProcess.Id}");
In the latest version of dotnetcore, the Attach to Process will display the application name in the process column. So the processid is not necessary.