pardeike / Harmony

A library for patching, replacing and decorating .NET and Mono methods during runtime
https://www.patreon.com/pardeike
MIT License
5.15k stars 485 forks source link

VS 2017 csproj is incompatible with pre-2017 Unity #87

Closed saki7 closed 6 years ago

saki7 commented 6 years ago

I'm writing a mod for Cities: Skylines (the game's built on pre-2017 UnityEngine), and seeing same errors as described in NuGet/Home#5460. Build fails due to NuGet errors, and there's no way of removing NuGet completely.

Harmony's csproj has been updated to the new VS 2017 project format in #73. It was working fine with older version of csproj. I also confirmed that the old csproj is still working in my sln. Are we going to drop this old Unity support, or is there any workaround for this?

pardeike commented 6 years ago

Not sure what you mean. I develop for RimWorld which uses Unity 5.6.3 and I build for target=3.5

saki7 commented 6 years ago

When I add Harmony csproj to my game plugin's sln, I get errors saying that NuGet is incompatible for net35-unity full v3.5 (note that this is not the same as version 3.5 of .NET Framework)

pardeike commented 6 years ago

What’s wrong with building a binary release and embedding it in your project?

saki7 commented 6 years ago

Few reasons:

pardeike commented 6 years ago

You get all that with a binary include. Almost all RimWorld mods do it that way. You lock the version. You get autocompletion anyway and the Harmony license allows for binary distribution.

The main problem is that however I decide I get a group of people who want it the other way. So there is no solution to this problem.

saki7 commented 6 years ago

OK. I understood. I'm fine for closing this issue as wontfix, thanks for the discussion :)

pardeike commented 6 years ago

And btw: sinne Harmony is a rather slow moving library my goal is to offer binary packages via NuGet or other common means. There should be no big benefit of compiling it yourself.

saki7 commented 6 years ago

@pardeike Yeah, I usually use official binary distribution for such libraries. But the Unpatch functinality is not included in latest release, no?

pardeike commented 6 years ago

No. Not yet. The reason being that Harmony grew out of the RimWorld community and thus has a quite large legacy to support. I recently moved on and fixed a few shortcomings with important things such as try-catch support in the underlying mechanics that required a way to solve the shared API conflicts that occur since Harmony is sharing state between different mods in the same host application.

So in order to prevent lots of unaware users in RimWorld to use the new release and breaking every other mod doing so, I had(have) to delay the next release more than I would like.

Two weeks ago, I found a workaround by having Harmony patch itself and started to use it actively in one of my more popular mods (20k users on steam) and it was a rocky journey. I am now on a seemingly stable situation and all that is left is to clean up and test the master branch. Once that is done I can get back on short incremental updates.