Getting started with a .NET 6.0 project in latest Alpha 2022.2.a13 is impossible?

I’m trying to get started with a prototype that uses the latest C# language features and .NET 6 SDK, so I installed Unity 2022.2 Alpha 13 and was disappointed to learn that my VS project file still generates with a ‘TargetFrameworkVersion’ of 4.7.1…

I’m assuming that this is because the Mono bundled with 2022.2 Alpha 13 does not include the Unity Mono fork that supports .NET 6.0?

What do I need to do in order to upgrade my copy of 2022.2 Alpha 13 with the latest Unity Mono fork?

If this is not the solution to achieve what I’m after, then what is?

I’ve read all the threads on here and I’m still confused what the current state of 2022.2 Alpha 13 is for .NET 6 integration… Documentation on how this is meant to work is virtually non existent for the alpha, so I don’t understand how you expect developers to test .NET 5 & 6 runtimes/features.

Is .NET 6 features only working for Il2Cpp at the moment?

If the Unity Mono fork does not currently support .NET 6, then how do I replace it with CoreCLR so I CAN use .NET 6?

My end goal is that my CS Proj file generated by this alpha build should show a Language Version of 10.0 and a TargetFramework of NET Standard 2.1, or Net 6.0, NOT 4.7.1…

There needs to be a serious documentation task that addresses this, either by creating an instructional thread on the Alpha build forum / this forum and linking it in the Mono Upgrade manual.

I’m sorry that you are experiencing these issues. However, Unity at 2022.2 alpha does not support .NET 6 as a build target. So it is not possible to accomplish what you are attempting.

You can select “.NET Standard” as the API Compatibility Level option, in which case you will get access to the .NET Standard 2.1 API.

You can find more details about Unity’s plans for .NET 6 (and later) support in a GDC talk posted in this thread: GDC 2022: The Future of .NET and Unity

We have not yet discussed release dates for this support though.

1 Like

Even when I select .NET Standard, for the 2.1 API, the CSProj file generated will still have a TargetFrameworkVersion of 4.7.x… So, am I misunderstanding how something works here?

Why is it that the build target cannot be changed to 5 or 6 for Unity?

I’m not sure how important TargetFrameworkVersion for a Unity CSProj file?

Make sure that you have the latest version of the Code Editor for Visual Studio package installed with the Unity project: https://docs.unity3d.com/Packages/com.unity.ide.visualstudio@2.0/manual/index.html. I believe that it generates the .csproj files.

Moving the Unity ecosystem to .NET 5 or 6 is a bit of a long process. You can watch the talk I linked to or check on this ongoing mega-thread for many more details: https://discussions.unity.com/t/836646

So I did as described in the manual for Unity, then I checked the project file produced by Unity and the TargetFrameworkVersion remains the same still, as NET Framework 4.7!

Shouldn’t the generator be creating a .NET Standard 2.1 project file?

I’ve read a lot and understand you’re hard at work upgrading to .NET 6+ and I want to know how I can create a barebones .NET Standard 2.1 project…

I should add that I have tried manually setting the framework by replacing the with a element instead, and put in the value Net Standard 2.1 – I have no idea how this is suppose to work, can you please provide guidance on what the expectations are here??

Also, I created an issue to track the documentation needed on VS side:
https://github.com/MicrosoftDocs/visualstudio-docs/issues/8027

I think it should generate a .NET Standard 2.1 project. Can you submit a bug report to Unity for this?

Yes that is a bug in vs package com.unity.ide.visualstudio/Editor/ProjectGeneration/ProjectGeneration.cs at b132c03a8a8f18403daa24fb837ba896e2b1d491 · needle-mirror/com.unity.ide.visualstudio · GitHub .

I don’t have this problem with Rider, it doesn’t generate TargetFrameworkVersion at all.

1 Like

Any news on the support for .Net5, .Net 6?

No, we don’t have any public release dates to announce yet. We do have a forum thread where this is discussed: Unity Future .NET Development Status

We are actively working on moving Unity to new .NET now though.

1 Like

Hello! Any news on this?

Still the same forum link as in the post above yours. It is WIP, making good progress, but no public announcement.

1 Like