Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild 0.1.0

dotnet add package Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild --version 0.1.0                
NuGet\Install-Package Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild" Version="0.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild --version 0.1.0                
#r "nuget: Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild as a Cake Addin
#addin nuget:?package=Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild&version=0.1.0

// Install Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild as a Cake Tool
#tool nuget:?package=Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild&version=0.1.0                

MonoMod.RuntimeDetour.HookGen.MSBuild

MonoMod's HookGen in MSBuild.
Forked from BepInEx.AssemblyPublicizer.

Note: This project is not officially linked with MonoMod.

Installation

Add this NuGet package in your csproj:

<ItemGroup>
    <PackageReference Include="Hamunii.MonoMod.RuntimeDetour.HookGen.MSBuild" Version="1.*" PrivateAssets="all"/>
</ItemGroup>

Usage

The usage is identical to BepInEx.AssemblyPublicizer, except HookGen is used instead of Publicize:

<ItemGroup>
    
    <Reference Include=".../TestProject.dll" HookGen="true" />
    <ProjectReference Include="../TestProject/TestProject.csproj" HookGen="true" />
    <PackageReference Include="TestProject" HookGen="true" />

    
    <HookGen Include="TestProject" />
</ItemGroup>

What is HookGen?

MonoMod's HookGen takes an assembly a generates a new assembly from it which contains MonoMod Hooks (On namespace) and ILHooks (IL namespace) as C# Events for almost every method, which you can subscribe to.

static class Example
{
    internal static void Init()
    {
        // Subscribing to hook events provided by HookGen
        On.SomeNamespace.SomeType.Method += MyHook;
        IL.SomeNamespace.SomeType.Method += MyILHook;
    }
    
    private static void MyHook(On.SomeNamespace.SomeType.orig_Method orig, SomeType self)
    {
        Plugin.Logger.LogInfo("Hello from MonoMod Hook!");
        orig(self); 
    }

    private static void MyILHook(ILContext il)
    {
        ILCursor c = new(il);
        // ...
        Plugin.Logger.LogInfo("IL modifications done!");
    }
}

What is not HookGen?

It's probably more likely that you only know HookGen, but not manual Hooking. For that, see the Lethal Company Modding Wiki.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.0 124 6/6/2024