Inject arbitrary IL code at compile time.
$ dotnet add package InlineIL.FodyThis is an add-in for Fody which lets you inject arbitrary IL into your assembly at compile time.
Install the NuGet packages Fody and InlineIL.Fody. Installing Fody explicitly is needed to enable weaving.
Add the PrivateAssets="all" metadata attribute to the <PackageReference /> items of Fody and InlineIL.Fody in your project file, so they won't be listed as dependencies.
If you already have a FodyWeavers.xml file in the root directory of your project, add the <InlineIL /> tag there.
See Fody usage for general guidelines, and Fody Configuration for additional options.
Call static methods of the InlineIL.IL.Emit class to emit IL instructions. Additional helper methods are available in the InlineIL.IL class.
See the GitHub repository for more information.