Lib.Harmony
2.3.3
dotnet add package Lib.Harmony --version 2.3.3
NuGet\Install-Package Lib.Harmony -Version 2.3.3
<PackageReference Include="Lib.Harmony" Version="2.3.3" />
paket add Lib.Harmony --version 2.3.3
#r "nuget: Lib.Harmony, 2.3.3"
// Install Lib.Harmony as a Cake Addin #addin nuget:?package=Lib.Harmony&version=2.3.3 // Install Lib.Harmony as a Cake Tool #tool nuget:?package=Lib.Harmony&version=2.3.3
<p align="center"> <img src="https://raw.githubusercontent.com/pardeike/Harmony/master/HarmonyLogo.png" alt="Harmony" width="180" /><br> <b>Version 2.3</b><br> A library for patching, replacing and decorating<br> .NET and Mono methods during runtime. </p>
About
Harmony gives you an elegant and high level way to alter the functionality in applications written in C#. It works great in games and is well established in titles like 7 Days To Die, BattleTech, Besiege, Cities:Skylines, Kerbal Space Program, Oxygen Not Included, Ravenfield, Rimworld, Sheltered, Stardew Valley, Staxel, Subnautica, The Ultimate Nerd Game, Total Miner, Unturned, SCP: Secret Laboratory and many more.
It is also used in unit testing WPF controls and in many other areas.
How it works
If you develop in C# and your code is loaded as a module/plugin into a host application, you can use Harmony to alter the functionality of all the available assemblies of that application. Where other patch libraries simply allow you to replace the original method, Harmony goes one step further and gives you:
• A way to keep the original method intact
• Execute your code before and/or after the original method
• Modify the original with IL code processors
• Multiple Harmony patches co-exist and don't conflict with each other
• Works at runtime and does not touch any files
Installation
If you want a single file, dependency-merged assembly, you should use the Lib.Harmony nuget package. This is the preferred way.
If you instead want to supply the dependencies yourself, you should use the Lib.Harmony.Thin nuget package. You get more control but you are responsible to make all references available at runtime.
Documentation
Please check out the documentation and join the official discord server.
Contribute
I put thousands of hours into this project and its support. So every little action helps:
• Become a GitHub sponsor or a Patreon
• Upvote this stackoverflow answer
• Spread the word in your developer communities
This project uses the great MonoMod.Core library by 0x0ade and nike4613.
Harmony 1
Harmony 1 is deprecated and not under active development anymore. The latest version of it (v1.2.0.1) is stable and contains only minor bugs. Keep using it if you are in an environment that exclusively uses Harmony 1. Currently Harmony 1.x and 2.x are NOT COMPATIBLE with each other and SHOULD NOT BE MIXED. The old documentation can still be found at the Wiki.
<br>
<p align="center"> <a href="../../blob/master/LICENSE"><img src="https://img.shields.io/github/license/pardeike/harmony.svg?style=flat-squared&label=License" /></a> <a href="../../releases/latest"><img src="https://img.shields.io/github/release/pardeike/harmony.svg?style=flat-squared&label=Release" /></a> <a href="https://harmony.pardeike.net"><img src="https://img.shields.io/badge/documentation-%F0%9F%94%8D-9cf?style=flat-squared&label=Documentation" /></a> </p> <p align="center"> <a href="https://github.com/pardeike/Harmony/releases/latest"><img src="https://img.shields.io/github/downloads/pardeike/Harmony/total.svg?style=flat-squared&logo=github&color=009900&label=Release%20Downloads" /></a> <a href="https://www.nuget.org/packages/Lib.Harmony"><img src="https://img.shields.io/nuget/dt/Lib.Harmony?style=flat-squared&logo=nuget&label=Nuget%20Downloads&color=009900" /></a> </p> <p align="center"> <a href="https://github.com/pardeike/Harmony/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/pardeike/Harmony/test.yml?style=flat-squared&logo=github&label=CI%20Tests" /></a> <a href="https://discord.gg/xXgghXR"><img src="https://img.shields.io/discord/131466550938042369.svg?style=flat-squared&logo=discord&label=Official%20Discord" /></a> </p> <p align="center"> <a href="mailto:andreas@pardeike.net"><img src="https://img.shields.io/badge/email-andreas@pardeike.net-blue.svg?style=flat-squared&label=Email" /></a> <a href="https://twitter.com/pardeike"><img src="https://img.shields.io/badge/twitter-@pardeike-blue.svg?style=flat-squared&logo=twitter&label=Twitter" /></a> </p>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net35 is compatible. net40 was computed. net403 was computed. net45 was computed. net451 was computed. net452 is compatible. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.0
- No dependencies.
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- Lib.Harmony.Ref (>= 2.3.3)
-
net5.0
- System.Text.Json (>= 5.0.2)
-
net6.0
- System.Text.Json (>= 6.0.9)
-
net7.0
- System.Text.Json (>= 7.0.4)
-
net8.0
- System.Text.Json (>= 8.0.1)
NuGet packages (79)
Showing the top 5 NuGet packages that depend on Lib.Harmony:
Package | Downloads |
---|---|
ClownFish.Nebula.net
简单易用的应用程序开发框架,支持多种架构模式(SaaS多租户/微服务/单体/模块化),内置强大的日志和监控能力。 |
|
Allure.Xunit
Create beautiful reports from your xUnit.net tests. |
|
Allure.SpecFlow
Create beautiful reports from your SpecFlow tests. |
|
WpfPilot
Next generation WPF automation testing. |
|
BrowserStack.TestAdapter
VS TestAdapter for integrating selenium tests with BrowserStack |
GitHub repositories (38)
Showing the top 5 popular GitHub repositories that depend on Lib.Harmony:
Repository | Stars |
---|---|
Sonarr/Sonarr
Smart PVR for newsgroup and bittorrent users.
|
|
Revolutionary-Games/Thrive
The main repository for the development of the evolution game Thrive.
|
|
JetBrains/resharper-unity
Unity support for both ReSharper and Rider
|
|
SychicBoy/NETReactorSlayer
An open source (GPLv3) deobfuscator and unpacker for Eziriz .NET Reactor
|
|
skyarkhangel/Hardcore-SK
Rimworld Hardcore SK project, our discord server:
|