Microsoft previews Unity extension for Visual Studio Code

I had zero problems migrating to the new extension on my laptop, but it simply cannot load the projects on my other machine. I’ve ensured I have the same versions of dotnet and all of the extensions installed on both machines: on one machine, there’s no problem, and on this one, the projects always fail with:

2023-11-14 10:26:28.006 [info] It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '6.0.0' was not found.
  - No frameworks were found.

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=win10-x64

2023-11-14 10:26:30.579 [info] Project system initialization finished. 0 project(s) are loaded, and 16 failed to load.

I’ve deleted and regenerated the csproj files many times in Unity, also confirmed they look the same on both machines. .NET is absolutely installed. I can even get things working in Visual Studio if I switch my external tools over to that in Unity, but I would prefer to stick with VSCode.

Does anyone know how I can rollback to the old deprecated extension? I had everything working for the last few years with VSCode if I simply never upgraded from com.unity.ide.vscode v1.1.3.

In case this is helpful, here’s the output from the C# Dev Kit:

Starting Spawn .NET server...
Starting Open a solution...
Starting Open a solution with environment service...
Starting Clear environment...
Using local .NET runtime at "c:\Users\User Name\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\7.0.13~x64\dotnet.exe"
.NET server started and IPC established in 779ms
Completed Spawn .NET server (1111ms)
Completed Clear environment (1374ms)
Completed Open a solution with environment service (1397ms)
Starting Restore solution...
Completed Open a solution (1404ms)
Starting NuGet restore for the solution.
Starting command: "dotnet.exe" restore C:\Users\User Name\Documents\GitHub\Little-Nemo\Little-Nemo.sln --interactive...
Completed command: "dotnet.exe" restore C:\Users\User Name\Documents\GitHub\Little-Nemo\Little-Nemo.sln --interactive (997ms)
Completed NuGet restore.
Completed Restore solution (998ms)

And the output from C# Dev Kit - Test Explorer:

Created Test Controller
unable to create test controller for c# extension: Error: Unable to locate the dotnet sdk.

Another thought: on the computer that this works, I have no spaces in my username, in the computer that it does not work I do have a space in my username. I saw that there was a bug in an earlier version of this extension that it broke when encountering spaces, but I’m on the latest.

Edit: I just created a new user with no spaces in the name and installed everything there and I’m seeing the same issue.

@diesoftgames it seems C# Dev Kit can find the runtime v7 (for its own use), but not the SDK v6 for the project dependencies.

Are you using the latest VS Editor package in your Unity project ? (latest should be 2.0.22). It is mandatory if you want to properly generate projects for Visual Studio Code.

Could you please double check that everything is properly setup using this doc:

Then if you still hit an issue, could you please create a ticket here: GitHub - microsoft/vscode-dotnettools: This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code

Thanks!

Yup, already done and done. I have everything set up according to the docs and posted an issue in that GitHub repo yesterday. Thank you!

Edit: After battling this for a full day trying to get it to work again, I had to give up and migrate to using Visual Studio Community instead of VSCode, but I would love to be able to return to VSCode so I’ll be keeping an eye on that issue.

Hi,
Seeking some clarity on the licensing requirement with Visual Studio Code :

As per Speed up debugging with Microsoft Visual Studio Code, it’s possible to use the the new Unity package with Visual Studio Code, Microsoft’s Open Source offering.

However, the new package uses the C# Dev Kit, which, per this note, C# Dev Kit extension FAQ, is a paid solution .

Can the new plugin be used in Visual Studio Code, on the same licensing terms as Visual Studio Code ?

C# Dev Kit and the Unity extension for Visual Studio Code are built on the same foundations as Visual Studio, they are licensed under similar terms as Visual Studio is.

This means they are free for individuals, academia, and open-source development, just like the terms that apply to Visual Studio Community. For organizations, C# Dev Kit and its family of extensions are included with Visual Studio Professional and Enterprise subscriptions, as well as GitHub Codespaces.

For additional details, please refer to the license terms.

1 Like

Thank you @sailro .
Can you confirm that Organisations need to use a Visual Studio Professional / Enterprise subscription, if they intend to use the C# Dev Kit, even in Visual Studio Code ?

Additionally, Microsoft has declared they will stop supporting Microsoft VS for the Mac in August 2024. What is the recourse for Unity developers on Mac?

It solved my problem. Thank you.

This worked for me too !

If i understand it correctly this package replaces the old vscode package? But there is no place to put Agrs like the old vscode one did.
Also the generated .csproj files doesn’t seem to work (with omnisharp).
Personally I don’t get what is happening here. But I am not complaining as long as the old vscode package still works like a charm in unity 6 preview for me.

The two pieces to this are the Unity extension for Visual Studio Code (the topic of this thread) and the Visual Studio Editor package for Unity. The two work in tandem and you should install both, this combination is the current recommended (and the only supported) method of using Visual Studio Code with Unity.

Also, be aware that the Visual Studio Code Editor package is no longer supported and won’t receive updates. Bugs will remain in perpetuity.

Jeesh. Didn’t even make it a year before dropping it. :frowning:

What do you mean? The Visual Studio Code Editor package refers to the old UPM package that was specific to Visual Studio Code. It had releases spanning 2019/01 to 2020/10, close to two years.
https://discussions.unity.com/t/886480

1 Like

AH, What a relief! I thought you meant the new Microsoft extensions and support was already being abandoned.

Ah I see, I confused the vscode plugin with the unity package.
But this just makes me sadder… they are essentially making a Visual Studio inside of vscode with this plugin. I guess I will check out the community fork of the old vscode package since I want nothing like an IDE or a debugger.
In any case, thank you for pointing out what I missed.

Can you clarify this a bit? I don’t get a bit of what you’re saying. VS Code is VS Code and VS is VS, I agree the naming is (very) weird, but if you want VS Code supported in Unity, this is the new official way of getting that support, and from my experience, it works pretty well, and I was happy to be able to continue with my non-Rider fully customizable freeware workflow. What I don’t get is why would you insist on using the old community fork, what would be the point of that?

1 Like

After updating Visual Studio, I got this message that Visual Studio for Mac has been retired What happened to Visual Studio for Mac | Microsoft Learn

Tried VSCode but I’m not getting the Unity docs

Is there a way to add the missing integrated unity docs in VSCode too?

1 Like

Install Unity extension into VS Code: Unity - Visual Studio Marketplace

I also have the next extensions installed to make Unity work:

Thanks! I did have all installed except “IntelliCode for C# Dev Kit”. Instealled it, restarted VSCode and still no luck.

1 Like

Did you install the Visual Studio Package in UPM?
Did you indicate as Code Editor in Preferences?
Did you regenerate project files in Preferences?