Outdated Lib.Harmony version on NuGet
Closed this issue · 3 comments
The Issue
There is a problem with the lowest version for Lib.Harmony which the OWML NuGet requires. As its dependencies, it requires Json.Net.Unity3D (>= 9.0.1) and Lib.Harmony (>= 1.2.0.1). The Harmony library has two different namespaces depending on the version that you are using, Harmony
for versions <= 2.0 and HarmonyLib
for versions >= 2.0, which indicates that neither are compatible, and this is where the problem lies.
For some reason the NuGet, instead of getting the latest Harmony version, uses the lowest one allowed (1.2.0.1):
And, OWML uses the 2.5.5.0 version:
This means that when you use the NuGet you can't use Harmony as normal in a mod, because not only you are using an incompatible version but the namespaces are different.
Some points to note
As you might notice, while Harmony doesn't work, the ModHelpers for it do. I theorize that, because you are not interacting with the 0Harmony.dll namespace, you don't get this incompatibility issue.
A possible fix
Maybe by updating the OWML NuGet to require a version that is >= 2.0 this issue will be fixed.
Hi, try using HarmonyX in your mod:
<PackageReference Include="HarmonyX" Version="2.5.5" />
It's a different package, a port of Harmony.
OWML referencing an old version of Harmony seems to be a bug, but shouldn't be an issue if you use HarmonyX instead of Harmony. Let me know how that works out.
It indeed worked out, many thanks. I think the ModTemplate should tell about referencing it or it should have it already referenced in the .csproject.
I think this has been fixed. Closing the issue, let me know if it's still an issue.