Freshen up .NET SDK and target frameworks - #2265
Conversation
Using the latest .NET SDK introduced build warnings that I'm targeting unsupported .NET 6 and 7 frameworks. It also pointed out that we're missing C# `scoped` keywords in several places. But that keyword isn't allowed without C# language version 11. I'm leaving the .NET 6 target framework in place for the shipping assemblies.
|
Officially Unity only supports C# version 9, though even that is incomplete. See https://docs.unity3d.com/6000.0/Documentation/Manual/csharp-compiler.html. There are ways to partially support newer versions, though I don't have personal experience with doing so. |
|
Thanks for your insight and doc link, @jsteinich. Our master branch targets C# 12. So I'm wondering how it works with unity. Maybe it's that in v3 we finally stopped presenting messagepack-csharp as source code to unity, instead preferring a dll? |
The generation code would be able to target newer features as it's just dependent on what runtime the developer is using. The runtime library would be able to use newer syntax, but it is still limited to roughly netstandard 2.1 runtime features (unless referencing packages that add in the missing functionality). The generated code is potentially visible to Unity, so might still carry C# 9 restrictions, though there are different ways to set things up that may only have the runtime restrictions. |
Using the latest .NET SDK introduced build warnings that I'm targeting unsupported .NET 6 and 7 frameworks. It also pointed out that we're missing C#
scopedkeywords in several places. But that keyword isn't allowed without C# language version 11. So I bumped that too. I'm hoping that that isn't a problem since in v3 we've already taken advantage of the fact that all modern/supported Unity versions already support C# 12.I'm leaving the .NET 6 target framework in place for the shipping assemblies.