Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Visual Code Error + No Intellisense

Discussion in 'Code Editors & IDEs' started by AjaXI, Jan 7, 2023.

  1. AjaXI

    AjaXI

    Joined:
    Sep 13, 2020
    Posts:
    9
    I just got into Unity yesterday but I can't get Visual code to Work.
    First, I'm getting these errors in the Omnisharp Log:
    Code (CSharp):
    1. Starting OmniSharp server at 1/7/2023, 2:49:38 PM
    2.     Target: c:\Users\Aymane\First Project\First Project.sln
    3.  
    4. OmniSharp server started with .NET 7.0.101
    5. .
    6.     Path: c:\Users\Aymane\.vscode\extensions\ms-dotnettools.csharp-1.25.2-win32-x64\.omnisharp\1.39.2-net6.0\OmniSharp.dll
    7.     PID: 10192
    8.  
    9. [info]: OmniSharp.Stdio.Host
    10.         Starting OmniSharp on Windows 10.0.19045.0 (x64)
    11. [info]: OmniSharp.Services.DotNetCliService
    12.         Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
    13. [info]: OmniSharp.Services.DotNetCliService
    14.         Using the 'dotnet' on the PATH.
    15. [info]: OmniSharp.Services.DotNetCliService
    16.         DotNetPath set to dotnet
    17. [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    18.         Located 1 MSBuild instance(s)
    19.             1: .NET Core SDK 7.0.101 17.4.0 - "C:\Program Files\dotnet\sdk\7.0.101\"
    20. [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    21.        Registered MSBuild instance: .NET Core SDK 7.0.101 17.4.0 - "C:\Program Files\dotnet\sdk\7.0.101\"
    22. [info]: OmniSharp.WorkspaceInitializer
    23.        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    24. [info]: OmniSharp.Cake.CakeProjectSystem
    25.        Detecting Cake files in 'c:\Users\Aymane\First Project'.
    26. [info]: OmniSharp.Cake.CakeProjectSystem
    27.        Did not find any Cake files
    28. [info]: OmniSharp.MSBuild.ProjectSystem
    29.        Detecting projects in 'c:\Users\Aymane\First Project\First Project.sln'.
    30. [info]: OmniSharp.MSBuild.ProjectManager
    31.        Queue project update for 'c:\Users\Aymane\First Project\Assembly-CSharp.csproj'
    32. [info]: OmniSharp.Script.ScriptProjectSystem
    33.        Detecting CSX files in 'c:\Users\Aymane\First Project'.
    34. [info]: OmniSharp.Script.ScriptProjectSystem
    35.        Did not find any CSX files
    36. [info]: OmniSharp.WorkspaceInitializer
    37.        Configuration finished.
    38. [info]: OmniSharp.Stdio.Host
    39.        Omnisharp server running using Stdio at location 'c:\Users\Aymane\First Project' on host 10572.
    40. [info]: OmniSharp.MSBuild.ProjectManager
    41.        Loading project: c:\Users\Aymane\First Project\Assembly-CSharp.csproj
    42. [fail]: OmniSharp.MSBuild.ProjectLoader
    43.        The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
    44. [warn]: OmniSharp.MSBuild.ProjectManager
    45.        Failed to load project file 'c:\Users\Aymane\First Project\Assembly-CSharp.csproj'.
    46. c:\Users\Aymane\First Project\Assembly-CSharp.csproj
    47. C:\Program Files\dotnet\sdk\7.0.101\Microsoft.Common.CurrentVersion.targets(1229,5): Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
    48.  
    49. [fail]: OmniSharp.MSBuild.ProjectManager
    50.        Attempted to update project that is not loaded: c:\Users\Aymane\First Project\Assembly-CSharp.csproj
    51. [warn]: OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService
    52.        Inlay hints requested for document not in workspace Location { FileName = c:\Users\Aymane\First Project\Assets\NewBehaviourScript.cs, Range = Range { Start = Point { Line = 0, Column = 0 }, End = Point { Line = 18, Column = 0 } } }
    And second, there is no Intellisense why I try to code.
    Please help and thank you :)
     
  2. anglerge

    anglerge

    Joined:
    Dec 18, 2020
    Posts:
    15
  3. AjaXI

    AjaXI

    Joined:
    Sep 13, 2020
    Posts:
    9
    I did, the ordinary Visual Studio 2022 works just fine.
     
  4. SAM-tak

    SAM-tak

    Joined:
    May 14, 2014
    Posts:
    7
    upload_2023-3-26_12-5-53.png
    Try 'regenerate project files'. It works fine for me.
     
  5. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,098
    Check the extension readme on GitHub. To work with Unity, you need to set
    omnisharp.useModernNet
    to
    false
    and install some additional stuff (Full .Net Framework Runtime and MSBuild Tools on Windows, a preview version of Mono on macOS).