ModuleInit
Adds a module initializer to an assembly.
Install / Use
/learn @fodyarchived/ModuleInitREADME
<img src="/package_icon.png" height="30px"> ModuleInit.Fody
Adds a module initializer to an assembly.
This is an add-in for Fody
It is expected that all developers using Fody either become a Patron on OpenCollective, or have a Tidelift Subscription. See Licensing/Patron FAQ for more information.
Usage
See also Fody usage.
NuGet installation
Install the ModuleInit.Fody NuGet package and update the Fody NuGet package:
PM> Install-Package Fody
PM> Install-Package ModuleInit.Fody
The Install-Package Fody is required since NuGet always defaults to the oldest, and most buggy, version of any dependency.
Add to FodyWeavers.xml
Add <ModuleInit/> to FodyWeavers.xml
<Weavers>
<ModuleInit/>
</Weavers>
What it does
Based on Einar Egilsson's suggestion using cecil to create module initializers [http://tech.einaregilsson.com/2009/12/16/module-initializers-in-csharp/]
Finds a class, in the target assembly, named 'ModuleInitializer' with the following form.
public static class ModuleInitializer
{
public static void Initialize()
{
//Init code
}
}
Injects the following code into the module initializer of the target assembly. This code will be called when the assembly is loaded into memory
static <Module>()
{
ModuleInitializer.Initialize();
}
Icon
Icon courtesy of The Noun Project
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
