DOTNET_STARTUP_HOOKS
environment variable
Criteria | Value |
---|---|
Permissions | Admin |
Security context | User; System1 |
Persistence type | Other |
Code type | DLL2 |
Launch type | Automatic3; User initiated4 |
Impact | Non-destructive |
OS Version | All OS versions |
Dependencies | OS only |
Toolset | Scriptable |
You can set the
DOTNET_STARTUP_HOOKS=path/to/assembly.dll
environment variable and then run a .NET app and the runtime will load your assembly.dll beforeMain
and callStartupHook.Initialize()
in it.
https://github.com/dotnet/runtime/blob/main/docs/design/features/host-startup-hook.md