Home > OS >  Omnisharp C# Not Working on Ubuntu 22.04 with Unity
Omnisharp C# Not Working on Ubuntu 22.04 with Unity

Time:06-28

Due to Windows giving me new problems day by day, I permanently moved to Linux (Kubuntu 22.04 LTS). But while working with Unity Editor, VS Code doesn't provide me with Intellisense.

In My System: mono-complete dotnet-sdk-6.0 && aspnetcore-runtime-6.0 packages are Installed

In VS Code: "C# Extension" is Installed

Case I:-

omnisharp.useModernNet: false

Output:

Starting OmniSharp server at 26/6/2022, 2:58:43 pm
    Target: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/3D Shooter.sln

OmniSharp server started with Mono 6.8.0.
    Path: /home/anany-aadil/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.omnisharp/1.39.0/omnisharp/OmniSharp.exe
    PID: 34448

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 22.4 (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 0 MSBuild instance(s)
Could not locate MSBuild instance to register with OmniSharp.
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

Case 2:-

omnisharp.useModernNet: true

Output:

Starting OmniSharp server at 26/6/2022, 3:10:09 pm
    Target: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/3D Shooter.sln

OmniSharp server started with .NET 6.0.301
.
    Path: /home/anany-aadil/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.omnisharp/1.39.0-net6.0/OmniSharp.dll
    PID: 35601

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[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.301 17.2.0 - "/usr/share/dotnet/sdk/6.0.301/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 6.0.301 17.2.0 - "/usr/share/dotnet/sdk/6.0.301/"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/3D Shooter.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/anany-aadil/Desktop/UnityProjects/3D Shooter'.
[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 '/home/anany-aadil/Desktop/UnityProjects/3D Shooter' on host 35481.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj'.
/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj
/usr/share/dotnet/sdk/6.0.301/Microsoft.Common.CurrentVersion.targets(1221,5): Error: This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).

[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj'.
/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj
/usr/share/dotnet/sdk/6.0.301/Microsoft.Common.CurrentVersion.targets(1221,5): Error: This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj

Any Fix? Thank you

CodePudding user response:

Ok I have solved the problem.

what I did was to remove the Microsoft Package of dotnet (sdk & runtime) and installed the snap version.

And I also completely removed mono-complete and installed it again and Voila! It works now Thanks

  • Related