[QUESTION] Why does LabAPI requires targeting to the .NET Framework 4.8?
This makes plugin development on Linux impossible. As far as I can understand, this is not some reflection issue or some other technical limitation known to me. So, is there any specific reason why both LabAPI and EXILED use such an old framework?
Sorry, if it is not a place for questions about the API, I just saw question label, and I also couldn't found LabAPI channel in the SCP: Secret Laboratory Discord server.
Hello, this is because Unity itself does it. You can make plugin in higher ,NET version but it will cause issues as they are different versions.
Hello, this is because Unity itself does it. You can make plugin in higher ,NET version but it will cause issues as they are different versions.
Oh, thank you for the answer!
I've got curious and tested to see if the LabAPI could load a plugin compiled for .NET 5.
I took this example: https://github.com/northwood-studios/LabAPI/tree/9e6f8f78344924194749e42f095426a88549f731/LabApi.Examples/LogAll/LogPlugin
I've created a new project, copy-pasted contents of the main two files, compiled, uploaded to a server, and it worked! No errors or warnings whatsoever, all events have been logged. One little problem is that any language version above 9 can't be used in .NET 5, so I tried to do the same thing with .NET 8 and C# 13, and yup, it works as well.
Of course it's not a comprehensive example, it only includes event assigning and logging, but just theoretically plugin assemblies compiled for the higher .NET versions can be loaded.
So, for those using Windows as their daily driver, there is no reason to use .NET instead of .NET Framework, but other people, just theoretically, can use .NET. However, this requires more extensive testing.
I'll leave it up to the maintainers to decide whether to close this issue, as this question's discussion can possibly be useful for people to share their experience with using .NET as the compilation target for a plugin.
Feel free to leave any further comments on higher .NET version from your experience
It depends on whether .NET Core-specific classes are used (such as PriorityQueue) - if these exist in the code, a System.TypeLoadException will occur.
If you only want to use the features, I recommend using PolySharp and setting LangVersion.
You can use newest .net (as net8) to build a netframework48 project on linux (probably on windows too) you can also use the newest net version to describe a usable LangVersion into the project so can use filescope namespace or [] in list/dictionary.
Since unity is made on net4x (framework 4.x.x) not really good and usable to have a plugin that built with target framework as net8 (or net5+). Since on loading it will throw an error that it cannot find (or load) the targeted frameworks assemblies.