Skip to content

Freshen up .NET SDK and target frameworks - #2265

Open
AArnott wants to merge 2 commits into
v2.xfrom
update-v2.x
Open

Freshen up .NET SDK and target frameworks#2265
AArnott wants to merge 2 commits into
v2.xfrom
update-v2.x

Conversation

@AArnott

@AArnott AArnott commented May 15, 2026

Copy link
Copy Markdown
Collaborator

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. 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.

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.
@AArnott AArnott added this to the v2.5 milestone May 15, 2026
@AArnott
AArnott requested a review from neuecc May 15, 2026 02:02
@jsteinich

Copy link
Copy Markdown
Contributor

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.

@AArnott

AArnott commented May 18, 2026

Copy link
Copy Markdown
Collaborator Author

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?

@jsteinich

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants