'Get Environment Variable From DOTNET_STARTUP_HOOKS

In my ASP.Net Core project:

  1. I set Environment Variable in launchSettings.json with DOTNET_STARTUP_HOOKS to load dll files.
  2. I use Environment.GetEnvironmentVariable("DOTNET_STARTUP_HOOKS") to check what I get from DOTNET_STARTUP_HOOKS acutally.
  3. After I changed IDE from VS2019 to VS2022. Without any changing on my project, I found that DOTNET_STARTUP_HOOKS loads 2 following files which I didn't set in launchSettings.json.

C:\Program Files\dotnet\SDK\6.0.201\DotnetTools\dotnet-watch\6.0.201-servicing.22124.17\tools\net6.0\any\middleware\Microsoft.AspNetCore.Watch.BrowserRefresh.dll;

C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Web Tools\Browser Link\Microsoft.WebTools.BrowserLink.Net.dll

Does anyone know what happended and how to let DOTNET_STARTUP_HOOKS stop to call these 2 files?

Thank you...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source