1

I am trying to set up a C# project with VSCode through Unity. I installed the .NET Devkit and C# extention for VSCode, and set the "External Script Editor" to VSCode in Unity Preferences. However, every time I try to use Intellisense, nothing appears. The console output at the bottom reads as follows:

2023-06-22 12:55:53.164 [warning] The project file 'c:\Users\<user>\Documents\Unity Projects\<project name>\Assembly-CSharp.csproj' is in unsupported format (for example, a traditional .Net Framework project). It need be converted to new SDK style to work in C# Dev Kit.
2023-06-22 12:55:53.267 [error] Failed to load project 'c:\Users\<user>\Documents\Unity Projects\<project name>\Assembly-CSharp.csproj'. One or more errors occurred. (This project is not supported in C# Dev Kit.)
2023-06-22 12:55:53.273 [info] Project system initialization finished. 0 project(s) are loaded, and 1 failed to load.

How do I convert the .csproj to a "traditional .NET Framework project" and still have it work with Unity?

I am on Windows 10.

I have:

  • Uninstalled and Reinstalled VSCode
  • Updated the "Visual Studio Code" Extension in Unity
  • Installed the .NET Devkit
  • Checked that VSCode is selected in Unity as the external script editor
  • Turned off Omnisharp Modern NET usage

(in no particular order)

Here's the tutorial I followed.

qwerty4o4
  • 71
  • 1
  • 7

5 Answers5

5

FIGURED IT OUT, I had a more recent version of the .NET Devkit than the one Unity used. I uninstalled version 4.8.1 and installed 4.7.1 instead, and it worked.

qwerty4o4
  • 71
  • 1
  • 7
1

I found another way, I was suspecting the 'upgrade' popup that created the version problem, so I tried:

1. Go to extensions in vscode

2. Find C# and click on "switch to release version"

I figured this out when I was looking at the C# extension output. It uses a different Dotnet SDK than my system. So in the future, manually selecting the version might be needed.

EDIT 1

Since I changed versions, I also changed the version of C# Dev Kit in VSCode because the older SDK version is not compatible with the latest version of C# Dev Kit extension (not necessarily needed though, but some features might not work)

0

I use 4.7.1 as well, but I still have Exactly the same issue. May I ask you which .Net(core) version you use?

My Versions:

  • .Net version: 7.0
  • .Net Developer pack: 4.7.1

I also did all the other thing listed in your question.

2023-07-08 12:26:33.690 [warning] The project file 'c:\Users\<user>\Desktop\<project name>\Assembly-CSharp.csproj' is in unsupported format (for example, a traditional .Net Framework project). It need be converted to new SDK style to work in C# Dev Kit.
2023-07-08 12:26:33.745 [error] Failed to load project 'c:\Users\<user>\Desktop\<project name>\Assembly-CSharp.csproj'. One or more errors occurred. (This project is not supported in C# Dev Kit.)
2023-07-08 12:26:33.748 [info] Project system initialization finished. 0 project(s) are loaded, and 1 failed to load.
derloopkat
  • 6,232
  • 16
  • 38
  • 45
0

Was having the same issue, and after some fighting, I figured that my C# extension for VSCode was on the pre-release branch, which was using the 2.x version instead of the 1.26.0.

Switching to the release branch fixed it, even though if it seems to create issues with the C# Dev Kit extension that requires the pre-release version of the C# extension.

xEc
  • 359
  • 2
  • 12
0

Using:

  • Unity: 2022.3.6f1

In my case the issue was the unity packages instead of the vs code extensions.

When the "3D core" template option is selected in unity hub the project comes with a suite of packages pre installed called "Engineering".

enter image description here

In this suite is included the legacy package for vs code, but as is mentioned in the docs, only is needed the "Visual Studio Editor 2.0.22" also included, but you can't remove the legacy one individually, due to this, is necesary to remove the entire suite first and then install the package manually.

Then in the external tools window should be the option to select vs code as an option with the version.

enter image description here

Noted that also appears bellow that the package is enabled.

And finally is necesary to regenerate the project files, after that the .csproj file should be with the new format and everything should work normally from now.

Hope this alternative solution help someone!