/Harmony

A library for patching, replacing and decorating .NET and Mono methods during runtime

Primary LanguageC#MIT LicenseMIT

Harmony

v1.0.9.1 Documentation

A library for patching, replacing and decorating .NET and Mono methods during runtime.


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 in fact well established in games like

  • Rimworld
  • The Long Dark
  • Oxygen Not Included
  • Subnautica
  • 7 Days To Die
  • Cities: Skylines
  • Kerbal Space Program
  • Besiege
  • Stardew Valley
  • Staxel
  • Total Miner
  • Ravenfield
  • The Ultimate Nerd Game

It is also used in unit testing Windows Presentation Foundation controls and in many other areas.

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

Please check out the documentation on the GitHub Wiki

Also, an introduction to Transpilers: Simple Harmony Transpiler Tutorial


Help by promoting this library so other developers can find it. One way is to upvote this stackoverflow answer. Or spread the word in your developer communities. Thank you!

For more information from me and my other open source projects, follow me on twitter: @pardeike

Hope you enjoy Harmony!


Email: andreas@pardeike.net Twitter: @pardeike MIT License