How to set ASPNETCORE_ENVIRONMENT when profiling .NET Core App?
Hi, I'm trying to profile my .NET Core app using dotTrace, but Running the app via dotTrace continually fails.
After some tries I found out that the problem is that dotTrace is running the app with ASPNETCORE_ENVIRONMENT=Production (which seems to be default value), but since it's local profiling I just want to set that envVar as `ASPNETCORE_ENVIRONMENT=Development`.
dotTrace seems to support app argument inputs when local profiling, but not any kinda environment variable. Is there any solution to troubleshoot the issue?
Please sign in to leave a comment.
Hi Jay,
In your case you can try to start dotTrace with ASPNETCORE_ENVIRONMENT=Development variable as it is described, for example, here: https://superuser.com/questions/424001/launch-windows-program-with-custom-environment-variable and then start profiling of your application.
Please let me know about the result.
I just found this useful, search for
ConfigurationBuilderhttps://andrewlock.net/how-to-set-the-hosting-environment-in-asp-net-core/
Also as a temporary workaround, you can add a variable in JetBrains.Profiler.Windows.Impl.dll.config file in dotTrace installation folder (%localappdata%\JetBrains\Installations\dotTrace182 by default). We plan to implement a UI for this in the next version.
Note: currently you can set environment variables from the GUI: