You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In .Net core apps, they are typically run via "dotnet MyProgram.dll". This means the program name will always use "dotnet" as the program name. It would be really handy if this could be detected and the name of the actual .net core console app could be used.
I hacked up some local mods to effect these changes. Effectively, if the process name is "dotnet" I retrieve the entity dotnet is executing via
As it turns out, .Net standard 1.3 doesn't have the GetEntryAssembly() method, so I modified the project to add a .Net Standard 2.0 to the frameworks and conditionally compile the code above on .NetStandard 2.0.
My visual studio 2017 did some migration on the project so I'll include the csproj file that resulted from that since that is where I had to set up the .Net Standard 2.0 build. dotnetcore-process-name.patch.txt
The text was updated successfully, but these errors were encountered:
Would this be considered a reasonable feature to have then? (the other changes to the project and targets and such in the attached patch should have already been done now)
In .Net core apps, they are typically run via "dotnet MyProgram.dll". This means the program name will always use "dotnet" as the program name. It would be really handy if this could be detected and the name of the actual .net core console app could be used.
I hacked up some local mods to effect these changes. Effectively, if the process name is "dotnet" I retrieve the entity dotnet is executing via
System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
As it turns out, .Net standard 1.3 doesn't have the GetEntryAssembly() method, so I modified the project to add a .Net Standard 2.0 to the frameworks and conditionally compile the code above on .NetStandard 2.0.
My visual studio 2017 did some migration on the project so I'll include the csproj file that resulted from that since that is where I had to set up the .Net Standard 2.0 build.
dotnetcore-process-name.patch.txt
The text was updated successfully, but these errors were encountered: