.Net: Running code when assembly is loaded

The CLR supports module initializers. You’d have to hack C++/CLI code or ilasm.exe to use them.

UPDATE: directly supported in C# as well since .NET 5 with the [ModuleInitializer] attribute

Leave a Comment