Search code examples
.net-coredotnet-cli

Why does dotnet run launch 2 processes?


When I run my dotnet core 2 app from my PowerShell I always see 2 processes launched. This is annoying as in Visual Studio 2017 I cannot "reattach" a debugger as there are always 2 processes with the same name "dotnet".

enter image description here

Any way to change this?


Solution

  • dotnet run is a development command that builds the project and queries the project for the actual command to run. It then launches the program described in the program - which may be a dotnet some.dll or someapp.exe depending on the program type.

    To work around your issue, run a command like

    dotnet bin\Debug\netcoreapp2.0\mapp.dll
    

    directly to avoid process noise.

    You can also chain a build command before it so you can rebuild the project on changes and still have the process that runs msbuild terminate:

    dotnet build; dotnet bin\Debug\netcoreapp2.0\mapp.dll