I recently came across the preapplicationstartmethod that is there for asp.net applications. I need something like that for console apps. I have a external logging dll. I want to configure logging such that on referencing the dll some code of logging automatically gets executed. I just need to call a class constructor before any other code is executed. Any help would be appreciated.
Like Application Insights automatically collects perf counters on adding reference to the mvc application and adding instrumentation key to config file. I need something like that for console apps.
Any code in static initializer of the class containing
Main
will be executed prior to enteringMain
:Demo.