Home > Back-end >  Unity intellisense in VScode not working and Omnisharp is giving multiple errors and warnings
Unity intellisense in VScode not working and Omnisharp is giving multiple errors and warnings

Time:10-04

So, I'm kind of new to coding. I'm making a game in Unity and I just got to scripting. Unfortunately, VScode is not working with me. I've installed the latest C# extension in VScode and .NET version is 6.0.401.

Whenever I boot up the IDE I get an error message

Some projects have trouble loading. Please review the output for more details.
Source: C# (Extension)

When I check the output, this is what it says:

Target: c:\Users\Drews\My project

OmniSharp server started with .NET 6.0.401
.
Path: c:\Users\Drews\.vscode\extensions\ms-dotnettools.csharp-1.25.0-win32- 
x64\.omnisharp\1.39.0-net6.0\OmniSharp.dll
PID: 6088

[info]: OmniSharp.Stdio.Host
    Starting OmniSharp on Windows 10.0.22000.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
    Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
    Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
    DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    Located 1 MSBuild instance(s)
        1: .NET Core SDK 6.0.401 17.3.1 - "C:\Program Files\dotnet\sdk\6.0.401\"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
    Registered MSBuild instance: .NET Core SDK 6.0.401 17.3.1 - "C:\Program 
Files\dotnet\sdk\6.0.401\"
[info]: OmniSharp.WorkspaceInitializer
    Invoking Workspace Options Provider: 
OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
    Detecting projects in 'c:\Users\Drews\My project\My project.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
    Queue project update for 'c:\Users\Drews\My project\UnityEngine.UI.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
    Queue project update for 'c:\Users\Drews\My project\Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
    Queue project update for 'c:\Users\Drews\My project\UnityEditor.UI.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
    Detecting CSX files in 'c:\Users\Drews\My project'.
[info]: OmniSharp.Script.ScriptProjectSystem
    Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
    Configuration finished.
[info]: OmniSharp.Stdio.Host
    Omnisharp server running using Stdio at location 'c:\Users\Drews\My project' on host 
788.
[info]: OmniSharp.MSBuild.ProjectManager
    Loading project: c:\Users\Drews\My project\UnityEngine.UI.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
    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
[warn]: OmniSharp.MSBuild.ProjectManager
    Failed to load project file 'c:\Users\Drews\My project\UnityEngine.UI.csproj'.
c:\Users\Drews\My project\UnityEngine.UI.csproj
C:\Program Files\dotnet\sdk\6.0.401\Microsoft.Common.CurrentVersion.targets(1220,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

[info]: OmniSharp.MSBuild.ProjectManager
    Loading project: c:\Users\Drews\My project\Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
    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
[warn]: OmniSharp.MSBuild.ProjectManager
    Failed to load project file 'c:\Users\Drews\My project\Assembly-CSharp.csproj'.
c:\Users\Drews\My project\Assembly-CSharp.csproj
C:\Program Files\dotnet\sdk\6.0.401\Microsoft.Common.CurrentVersion.targets(1220,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

[info]: OmniSharp.MSBuild.ProjectManager
    Loading project: c:\Users\Drews\My project\UnityEditor.UI.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
    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
[warn]: OmniSharp.MSBuild.ProjectManager
    Failed to load project file 'c:\Users\Drews\My project\UnityEditor.UI.csproj'.
c:\Users\Drews\My project\UnityEditor.UI.csproj
C:\Program Files\dotnet\sdk\6.0.401\Microsoft.Common.CurrentVersion.targets(1220,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

[fail]: OmniSharp.MSBuild.ProjectManager
    Attempted to update project that is not loaded: c:\Users\Drews\My 
project\UnityEngine.UI.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
    Attempted to update project that is not loaded: c:\Users\Drews\My project\Assembly- 
CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
    Attempted to update project that is not loaded: c:\Users\Drews\My 
project\UnityEditor.UI.csproj
[warn]: OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService
    Inlay hints requested for document not in workspace Location { FileName = 
c:\Users\Drews\My project\Assets\Scripts\Player.cs, Range = Range { Start = Point { Line 
= 0, Column = 0 }, End = Point { Line = 23, Column = 0 } } }
[warn]: OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService
    Inlay hints requested for document not in workspace Location { FileName = 
c:\Users\Drews\My project\Assets\Scripts\Player.cs, Range = Range { Start = Point { Line 
= 
0, Column = 0 }, End = Point { Line = 23, Column = 0 } } }

Also, the intellisense isn't working so I have to type things in manually. I am not nearly sane or smart enough to try to fix it. If any more info is needed, I will provide.

CodePudding user response:

I don't know why this isn't answered yet but to make it as simple as possible unity does not use the latest version of .net yet it still directs you to the link of the latest but it's written in the log that it's looking for version 4.7.1 download it from here my brother (download the devPack then restart ur pc) https://dotnet.microsoft.com/en-us/download/dotnet-framework/net471

CodePudding user response:

You need the Dot net developer pack version 4.7.1(not the runtime version) for VScode to work properly with Unity.

Make sure you close Vscode and Unity while installing the developer pack.

  • Related