3

When I try to use Intellisense for Unity Programming C#, it doesn't auto-complete.

I've tried settings, restarting, and reinstalling but it doesn't work.

The OS is MacOS Catalina

IDE is Visual Studio Code

I looked in the Omnisharp log to find this (Username and Time Removed):

    Target: /Users/anyuser/Documents/Unity Projects/My project/My project.sln

OmniSharp server started.
    Path: /Users/anyuser/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.0/run
    PID: 1418

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.15.7 (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: StandAlone 17.0.0 - "/Users/jc.carlos.cervantes/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.0/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/Users/anyuser/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.0/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 17.0.0 - "/Users/anyuser/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.0/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/anyuser/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.0/omnisharp/.msbuild/Current/Bin
            CscToolPath = /Users/anyuser/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.0/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /Users/anyuser/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.0/omnisharp/.msbuild
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/anyuser/Documents/Unity Projects/My project'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Did not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/Users/anyuser/Documents/Unity Projects/My project/My project.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/anyuser/Documents/Unity Projects/My project/Assembly-CSharp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/anyuser/Documents/Unity Projects/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 '/Users/anyuser/Documents/Unity Projects/My project' on host 1384.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/anyuser/Documents/Unity Projects/My project/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        This project targets .NET version that requires reference assemblies that do not ship with OmniSharp out of the box (e.g. .NET Framework). The most common solution is to make sure Mono is installed on your machine (https://mono-project.com/download/) and that OmniSharp is started with that Mono installation (e.g. "omnisharp.useGlobalMono":"always" in C# Extension for VS Code).
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/anyuser/Documents/Unity Projects/My project/Assembly-CSharp.csproj'.
/Users/anyuser/Documents/Unity Projects/My project/Assembly-CSharp.csproj
/Users/anyuser/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.0/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1217,5): Error: This project targets .NET version that requires reference assemblies that do not ship with OmniSharp out of the box (e.g. .NET Framework). The most common solution is to make sure Mono is installed on your machine (https://mono-project.com/download/) and that OmniSharp is started with that Mono installation (e.g. "omnisharp.useGlobalMono":"always" in C# Extension for VS Code).

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /Users/anyuser/Documents/Unity Projects/My project/Assembly-CSharp.csproj
[info]: OmniSharp.OmniSharpWorkspace
        Miscellaneous file: /Users/anyuser/Documents/Unity Projects/My project/Assets/NewBehaviourScript.cs added to workspace
Received response for /v2/blockstructure but could not find request.
Received response for /v2/codestructure but could not find request.
Received response for /v2/codestructure but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/getcodeactions but could not find request.

I have mono and these packages:

  • C#
  • Jupyter
  • Pylance
  • Python
  • Is the project a .Net Framework or .Net Core project? Looks like .Net Framework given the error message. – phuzi Feb 01 '22 at 08:58
  • Did you try the suggestion that is shown in the output? _The most common solution is to make sure Mono is installed on your machine (https://mono-project.com/download/) and that OmniSharp is started with that Mono installation (e.g. "omnisharp.useGlobalMono":"always" in C# Extension for VS Code)._ – phuzi Feb 01 '22 at 09:00
  • I tried reinstalling mono. – NewProgramme Feb 01 '22 at 09:04
  • what is the difference between .net core and framework – NewProgramme Feb 01 '22 at 09:06
  • because in dotnet folder ive got 3 v5s and 3 v3s (i thought at the moment i just had one), does that mean i have to put a different version in PATH – NewProgramme Feb 01 '22 at 09:11
  • .Net Framework is the "old" Windows only version of .Net (which is why you need Mono). .Net Core (and now just .Net from version 5) is the new, cross-platform version of .Net.) See https://stackoverflow.com/questions/38063837/whats-the-difference-between-net-core-net-framework-and-xamarin for a little more info – phuzi Feb 01 '22 at 09:15
  • So do I just remove the dot net folder from local as well as mono – NewProgramme Feb 01 '22 at 10:00
  • No, the problem appears to be that OmniSharp can't find Mono (Cross platform version of .Net Framework) – phuzi Feb 01 '22 at 10:02
  • But can I do what I just mentioned to use .net core instead – NewProgramme Feb 01 '22 at 10:17
  • To use .Net Core/.Net you will have to update the project and it's dependencies. – phuzi Feb 01 '22 at 10:19
  • Ok fine, how do I help omnisharp find mono – NewProgramme Feb 01 '22 at 10:30
  • You tagged this question with unity, please verify that you have an editor selected in your unity settings. You can find this in the external tools tab of the editor settings I believe. – IBXCODECAT Jan 29 '23 at 00:40

0 Answers0