skip to Main Content

I installed the required extensions for vscode using Unity extension from Microsoft, which automatically installs extensions like C# and C# Dev Kit.

I first got an error that says

Failed to load project "c:users...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.

I then converted it by adding the following code on top of the .csproj files

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>

Then it Worked. But is missing important components such as System.Math.PI

Showing the error 'System.Math' does not contain a definition for ‘PI’ CS0117`

2

Answers


  1. Chosen as BEST ANSWER

    Solution

    The problem was because Visual Studio Editor was stuck at version 2.0.18, While it had to be updated to 2.0.22 . So, I unlocked and updated it.

    Steps:

    1. Window >> Package Manager
    2. Search Visual Studio Editor
    3. Click Unlock
    4. Go to Version history tab
    5. Update to the latest, 2.0.22 at the time of writing

    This solves it And You will find Visual Studio Code [version] with the [version] included in Edit >> Preference >> External Tools >> External Script Editor, where you can choose visual studio code and click Regenerate project files

    More info here


  2. I’ve had issues with VSCode and Microsoft's Unity extension over the summer and in October (both on Windows and MacOS).

    These were the specific steps that helped me solve the issue in the past.

    If it still isn’t working, try a fresh installation with an empty Workspace and User settings.json. By that point something most likely will have fixed your issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search