Omnisharp-vscode: Intellisense not working on Ubunutu 17.04 with Unity 5.

Created on 31 Oct 2017  路  14Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

Starting OmniSharp server at 10/31/2017, 11:38:30 AM
    Target: /home/tobias/Project/Unity/HorrorCam/HorrorCam.sln

OmniSharp server started wth Mono
    Path: /home/tobias/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/run
    PID: 29701

OmniSharp: -s /home/tobias/Project/Unity/HorrorCam/HorrorCam.sln --hostPID 29604 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
锘匡豢{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Startup","Message":"Omnisharp server running using Stdio at location '/home/tobias/Project/Unity/HorrorCam' on host 29604."},"Seq":1,"Type":"event"}
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /home/tobias/Project/Unity/HorrorCam
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Omnisharp will use local MSBuild.
    MSBUILD_EXE_PATH: /home/tobias/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/omnisharp/msbuild/MSBuild.dll
    MSBuildExtensionsPath: /home/tobias/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/omnisharp/msbuild
    TargetFrameworkRootPath: /usr/lib/mono/xbuild-frameworks
    RoslynTargetsPath: /home/tobias/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/omnisharp/msbuild/Roslyn
    CscToolPath: /home/tobias/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/omnisharp/msbuild/Roslyn

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/home/tobias/Project/Unity/HorrorCam/HorrorCam.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /home/tobias/Project/Unity/HorrorCam/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/home/tobias/Project/Unity/HorrorCam/Assembly-CSharp.csproj'.
/home/tobias/Project/Unity/HorrorCam/Assembly-CSharp.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /home/tobias/Project/Unity/HorrorCam/Assembly-CSharp-firstpass.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/home/tobias/Project/Unity/HorrorCam/Assembly-CSharp-firstpass.csproj'.
/home/tobias/Project/Unity/HorrorCam/Assembly-CSharp-firstpass.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /home/tobias/Project/Unity/HorrorCam/Assembly-CSharp-Editor.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/home/tobias/Project/Unity/HorrorCam/Assembly-CSharp-Editor.csproj'.
/home/tobias/Project/Unity/HorrorCam/Assembly-CSharp-Editor.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/tobias/Project/Unity/HorrorCam'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Services.WorkspaceHelper
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Startup
        Configuration finished.

VS Code version: 1.17.2
C# Extension version: 1.12.1

Already tried

  • Updating Mono to latest
  • Updating OmniSharp
  • Removing all .csproj and .sln files to get newly generated ones

Steps to reproduce

  1. Open Unity Editor (latest Linux version)
  2. Open C# Project
  3. See errors in output log

Expected behavior

No errors and intellisense to work for Unity 5.

Actual behavior

I get several errors and I don't have any Unity intellisense.

Needs More Info

Most helpful comment

@badersur I installed Ubuntu 17.10 fresh without updating yea. I using version 1.13.1 extension

I didn't do anything special really.

  • Installed vscode from https://code.visualstudio.com/Download
  • Installed mono complete sudo apt-get install mono-complete. I cant remember why I needed that, but i remember it wasn't working and on the mono website it states The package mono-complete should be installed to install everything - this should cover most cases of "assembly not found" errors. So i tried it and it worked.
  • Installed C# for Visual Studio Code (powered by OmniSharp), Debugger for Unity, Unity Tools, Monobehaviour Snippets in the extensions tab in vscode. (thats pretty much all you need)
  • Installed vscode asset from Unity Asset Store https://www.assetstore.unity3d.com/en/#!/content/45320. I found I needed this for linux only, didn't need it for windows which was interesting. But it helped point console logs to the correct line in code. Without it, it would only open up the correct file but not point to the correct line. I said above I didn't need it, but I was wrong lol.

That's it, and it works perfectly, I use vscode from work (windows) and from home (linux) with unity with no issues at all. Hope that helped you out.

All 14 comments

This looks to me like https://github.com/OmniSharp/omnisharp-vscode/issues/1803. What version of Mono do you have installed?

I had same issue. Unity 2017.2 on Ubuntu 17.10.
Installing sudo apt-get install mono-complete helped me.

FYI: I'm assuming you don't need the VSCode asset anymore. I got it all working without it, on both my windows system and now my Ubuntu system.

Hello @brogan89

May I know which version of the extension you are using? The extension isn't working for me on Ubuntu 17.10! I just see:

Installing C# dependencies...
Platform: linux, x86_64, name=ubuntu, version=17.10

Downloading package 'OmniSharp for Linux (x64)'

Also, did you install a fresh copy of Ubuntu 17.10 without upgrading from an older version? and which version of node are you using?

Hello @brogan89. It seems like I can't download the dependencies from https://download.visualstudio.microsoft.com/; the connection times out!

I was able to install the extension from source and utilizing the packages' fallback urls to install them. Sorry for annoying you and have a good day :)

@badersur I installed Ubuntu 17.10 fresh without updating yea. I using version 1.13.1 extension

I didn't do anything special really.

  • Installed vscode from https://code.visualstudio.com/Download
  • Installed mono complete sudo apt-get install mono-complete. I cant remember why I needed that, but i remember it wasn't working and on the mono website it states The package mono-complete should be installed to install everything - this should cover most cases of "assembly not found" errors. So i tried it and it worked.
  • Installed C# for Visual Studio Code (powered by OmniSharp), Debugger for Unity, Unity Tools, Monobehaviour Snippets in the extensions tab in vscode. (thats pretty much all you need)
  • Installed vscode asset from Unity Asset Store https://www.assetstore.unity3d.com/en/#!/content/45320. I found I needed this for linux only, didn't need it for windows which was interesting. But it helped point console logs to the correct line in code. Without it, it would only open up the correct file but not point to the correct line. I said above I didn't need it, but I was wrong lol.

That's it, and it works perfectly, I use vscode from work (windows) and from home (linux) with unity with no issues at all. Hope that helped you out.

Thank you @brogan89 for you detailed replay :)

It seems like my laptop have some issues when connecting to microsoft's websites! Maybe I'll reinstall Ubuntu and hopefully it'll fix this issue!

I'm not a game developer but I may try unity one day.

@badersur in that case you should only need to install ms-vscode.csharp from the extensions. I'm not sure what could hinder the install sorry. It should just work out of the box. Best of luck.

@brogan89 The extension used to work for me after adding "csharp.fallbackDebuggerLinuxRuntimeId": "ubuntu.16.10-x64" to settings but I faced this issue recently.

I'm used to see similar connection issues while visiting websites using ASP.NET CDN and from nuget! Maybe microsoft doesn't like me. lol :)

Good luck to you, too.

same with me.
dotnet project work perfect,but unity can't work

my system

debian buster amd64
unity 2017.3.0.b1
dotnet-sdk-2.1.3
mono-complete 4.6.2 

output

Starting OmniSharp server at 2017-12-29 15:37:04
    Target: /home/ywaby/Documents/test/rope/rope.sln

OmniSharp server started wth Mono
    Path: /home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/run
    PID: 13059

锘縖info]: OmniSharp.Stdio.Host
        Starting OmniSharp on debian 0.0 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild
            CscToolPath = /home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/ywaby/Documents/test/rope'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /home/ywaby/Documents/test/rope
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/home/ywaby/Documents/test/rope/rope.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /home/ywaby/Documents/test/rope/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/home/ywaby/Documents/test/rope/Assembly-CSharp.csproj'.
/home/ywaby/Documents/test/rope/Assembly-CSharp.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /home/ywaby/Documents/test/rope/Assembly-CSharp-Editor.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/home/ywaby/Documents/test/rope/Assembly-CSharp-Editor.csproj'.
/home/ywaby/Documents/test/rope/Assembly-CSharp-Editor.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/ywaby/Documents/test/rope'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/ywaby/Documents/test/rope' on host 12927.
Starting OmniSharp server at 2017-12-29 15:37:07
    Target: /home/ywaby/Documents/test/rope/rope.sln

OmniSharp server started wth Mono
    Path: /home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/run
    PID: 13127

锘縖info]: OmniSharp.Stdio.Host
        Starting OmniSharp on debian 0.0 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild
            CscToolPath = /home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/ywaby/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/ywaby/Documents/test/rope'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /home/ywaby/Documents/test/rope
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/home/ywaby/Documents/test/rope/rope.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /home/ywaby/Documents/test/rope/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/home/ywaby/Documents/test/rope/Assembly-CSharp.csproj'.
/home/ywaby/Documents/test/rope/Assembly-CSharp.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /home/ywaby/Documents/test/rope/Assembly-CSharp-Editor.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/home/ywaby/Documents/test/rope/Assembly-CSharp-Editor.csproj'.
/home/ywaby/Documents/test/rope/Assembly-CSharp-Editor.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/ywaby/Documents/test/rope'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Stdio.Host
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/ywaby/Documents/test/rope' on host 12927.

fix by install newest version package from mono office(debian 9 repository)

@ywaby 's suggestion works well as a temporary solution. I followed the official instructions for adding the Debian 9 repo, followed by

sudo apt-get install mono-complete

This upgraded all existing mono packages on my system and installed a couple of new ones as well. After this, VS Code works like charm with Unity.

However, don't do this, unless you know what you're doing and how this affects your system.

Closing out this older issue, as this sounds like an issue with older mono (as of 2017). Latest mono in 2020 likely doesn't have this same problem, so we'll close it out. If you see this problem with the latest VSCode and latest C# plugin, please ping here and we can investigate.

For future readers, installing extension MSBuild project tools resolved the issue for me.

@cartermp I was having this issue today with VS Code 1.49.2 running on Arch Linux, C# plugin version v1.23.2

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.108
 Commit:    c423b556b5

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.108/

Host (useful for support):
  Version: 3.1.8
  Commit:  05a0c8f6b1

.NET Core SDKs installed:
  3.1.108 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.NETCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

No errors showing in Omnisharp log.

Since I did get it working with the MSBuild project tools package I don't personally need more help, but if you want more info I'll be happy to send any logs/etc you need

@cartermp I just freshly installed mono-complete on my ubuntu based distro (PopOS) and I get the following error from a fresh Unity Project with version 2019.4.12f1:

[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

I regenerated the unity project files and it is referencing that framework version inside the Assembly-CSharp.csproject file.

Do I need to switch that referenced version, or how can I fix this?

unity 2019.4.12f1
mono 6.8.0.105
.NET core SDK 3.1.403
Was this page helpful?
0 / 5 - 0 ratings