Open RenaKunisaki opened 5 years ago
I've always compiled the assembly from Visual Studio and relied on a post-build script in the project to deploy the assemblies to the mod directory. This script however, is unique to Windows.
I believe you can press F7 in-game to view the debug panel, which should show the log messages from the server as it is initialized/released. I'd be interested in knowing if changes to the source files are actually triggering the game to take any action, such as even stopping/starting the server.
I think the C# assembly is probably not being reloaded unless the game is restarted (like if plugins were initialized only once at application load time, which make sense from a software implementation point of view), but all web resources (css/html/js) could be changed and reloaded as the user/developer want. However it's been a long time I did not touch mod code, and I might be wrong regarding assembly load mechanism.
The logs suggest the server isn't being stopped/restarted at all.
Well, I found that I can use FileSystemWatcher
to know when my DLL gets replaced, and PluginManager.instance.ForcePluginsChanged()
to force a reload. But it doesn't actually reload the file, just stops and starts the plugins, so the server restarts but is still using the old version. (Also, some mods throw errors and/or crash the game when doing this...)
Any idea the correct way to reload a plugin from disk? Ideally without forcing reload of all other plugins?
No idea why the game doesn't do it automatically. Maybe it's just not supported on Linux for some reason.
I did some reserch and it seems the there is some mod config per-requisites to allow live reload. Page 6 of https://buildmedia.readthedocs.org/media/pdf/citiesskylinesmoddingguide/latest/citiesskylinesmoddingguide.pdf " To make the game reload your mod while running, change the last two lines in AssemblyInfo.cs to read:[assembly: AssemblyVersion("1.0.*")] "
Right, I've done that, still no effect. I tried changing to "2.0.*" as well.
I've been able to build and use the mod from source on Linux, but the game doesn't reload it. I have to exit and restart the game every time I make a change. Any ideas?