Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OmniSharp cannot locate Mono when using Z shell on macOS #1031

Closed
alexdima opened this issue Dec 12, 2016 · 12 comments
Closed

OmniSharp cannot locate Mono when using Z shell on macOS #1031

alexdima opened this issue Dec 12, 2016 · 12 comments
Assignees
Milestone

Comments

@alexdima
Copy link

Moved from microsoft/vscode#17049

From @rslnautic


  • VSCode Version: 1.7.2
  • OS Version: MacOs 10.12.1
    I use zsh. Not bash.

I can't use intellisense with C# and unity 5.5. I've tried hard but I can't solve it. Please Help!


Starting OmniSharp server at 12/11/2016, 6:41:17 PM
Target: /Users/rsl/Desktop/Jugs/Jugs.sln

OmniSharp server started wth Mono
Path: /Users/rsl/.vscode/extensions/ms-vscode.csharp-1.5.3/bin/run
PID: 881

OmniSharp: -s /Users/rsl/Desktop/Jugs/Jugs.sln --hostPID 865 --stdio DotNet:enablePackageRestore=false --encoding utf-8
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Startup","Message":"Omnisharp server running using Stdio at location '/Users/rsl/Desktop/Jugs' on host 865."},"Seq":1,"Type":"event"}
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Initializing in /Users/rsl/Desktop/Jugs
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Auto package restore: False
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Update workspace context
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Resolving projects references
[INFORMATION:OmniSharp#MSBuild] Detecting projects in '/Users/rsl/Desktop/Jugs/Jugs.sln'.
[INFORMATION:OmniSharp#MSBuild] Loading project from '/Users/rsl/Desktop/Jugs/Assembly-CSharp.csproj'.
[WARNING:OmniSharp#ProjectFileInfo] Couldn't locate Mono, TargetFrameworkRootPath not specified
[INFORMATION:OmniSharp#ProjectFileInfo] Using tools version: 15.0
[ERROR:OmniSharp#ProjectFileInfo] The reference assemblies for framework ".NETFramework,Version=v3.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
[WARNING:OmniSharp#MSBuild] Failed to process project file '/Users/rsl/Desktop/Jugs/Assembly-CSharp.csproj'.
/Users/rsl/Desktop/Jugs/Assembly-CSharp.csproj

[INFORMATION:OmniSharp.Startup] Configuration finished.

@michaelybecker
Copy link

Same here!

Macbook Pro, OSX v. 10.11.6
Unity 5.5.0f3 (the latest stable)
VSCode 1.7.2

Relevant Omnisharp log:
OmniSharp: -s /Volumes/HD-MAIN/Unity Projects/LD37/LD37.sln --hostPID 4814 --stdio DotNet:enablePackageRestore=false --encoding utf-8
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Startup","Message":"Omnisharp server running using Stdio at location '/Volumes/HD-MAIN/Unity Projects/LD37' on host 4814."},"Seq":1,"Type":"event"}
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Initializing in /Volumes/HD-MAIN/Unity Projects/LD37
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Auto package restore: False
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Update workspace context
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Resolving projects references
[INFORMATION:OmniSharp#MSBuild] Detecting projects in '/Volumes/HD-MAIN/Unity Projects/LD37/LD37.sln'.
[INFORMATION:OmniSharp#MSBuild] Loading project from '/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp-firstpass.csproj'.
[WARNING:OmniSharp#ProjectFileInfo] Couldn't locate Mono, TargetFrameworkRootPath not specified
[INFORMATION:OmniSharp#ProjectFileInfo] Using tools version: 15.0
[ERROR:OmniSharp#ProjectFileInfo] The reference assemblies for framework ".NETFramework,Version=v3.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
[WARNING:OmniSharp#MSBuild] Failed to process project file '/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp-firstpass.csproj'.
/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp-firstpass.csproj

[INFORMATION:OmniSharp#MSBuild] Loading project from '/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp.csproj'.
[WARNING:OmniSharp#ProjectFileInfo] Couldn't locate Mono, TargetFrameworkRootPath not specified
[INFORMATION:OmniSharp#ProjectFileInfo] Using tools version: 15.0
[ERROR:OmniSharp#ProjectFileInfo] The reference assemblies for framework ".NETFramework,Version=v3.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
[WARNING:OmniSharp#MSBuild] Failed to process project file '/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp.csproj'.
/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp.csproj

[INFORMATION:OmniSharp#MSBuild] Loading project from '/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp-Editor-firstpass.csproj'.
[WARNING:OmniSharp#ProjectFileInfo] Couldn't locate Mono, TargetFrameworkRootPath not specified
[INFORMATION:OmniSharp#ProjectFileInfo] Using tools version: 15.0
[ERROR:OmniSharp#ProjectFileInfo] The reference assemblies for framework ".NETFramework,Version=v3.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
[WARNING:OmniSharp#MSBuild] Failed to process project file '/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp-Editor-firstpass.csproj'.
/Volumes/HD-MAIN/Unity Projects/LD37/Assembly-CSharp-Editor-firstpass.csproj

[INFORMATION:OmniSharp.Startup] Configuration finished.

@potterdai
Copy link

It seems you have to install the latest mono from here http://www.mono-project.com/download/
I got the same problem, and got solved afterwards.

@michaelybecker
Copy link

Thanks a lot! Fixed it for me. (Mono was downloaded as part of a preview version of Visual Studio for mac, error went away - probably due to that fact.)

@rslnautic
Copy link

I've already installed mono. Still doesn't work!
I'm using zsh instead bash

@DustinCampbell
Copy link
Member

Likely, it's a problem with detecting the Mono path on zsh. The OmniSharp executes a series of Unix commands ("which", "readlink" and "pwd -P") to locate the real path of "mono". However, that appears to be failing:

[WARNING:OmniSharp#ProjectFileInfo] Couldn't locate Mono, TargetFrameworkRootPath not specified

@bbugh
Copy link

bbugh commented Jan 1, 2017

This wasn't working for me either, which was confusing because Mono is definitely installed. I checked the VSCode settings to see if there's an omnisharp setting. Sure enough, there's a setting omnisharp.useMono that is false by default. I set it to true in my user settings, restarted VS Code, and that fixed the problem for me.

@DustinCampbell
Copy link
Member

This wasn't working for me either, which was confusing because Mono is definitely installed. I checked the VSCode settings to see if there's an omnisharp setting. Sure enough, there's a setting omnisharp.useMono that is false by default. I set it to true in my user settings, restarted VS Code, and that fixed the problem for me.

That may in fact address the problem in some cases. This option has the effect of running OmniSharp on your installed Mono runtime rather than the one it includes.

@bbugh: What OS are you using? Also, are you using Bash or a different shell.

@bbugh
Copy link

bbugh commented Jan 2, 2017

Ah, right. I'm on Mac OS Sierra, using zsh.

@DustinCampbell DustinCampbell changed the title MacOs - C# and Unity 5.5 Intellisense doesn't work OmniSharp cannot locate Mono when using zsh shell on macOS Jan 3, 2017
@DustinCampbell
Copy link
Member

Thanks for confirming! I've retitled this issue to better describe the underlying bug.

@DustinCampbell DustinCampbell changed the title OmniSharp cannot locate Mono when using zsh shell on macOS OmniSharp cannot locate Mono when using Z shell on macOS Jan 3, 2017
@serialx
Copy link

serialx commented Jan 5, 2017

Add mono to PATH and it resolved the problem.

http://stackoverflow.com/questions/32542535/how-to-install-mono-on-macos-so-mono-works-in-terminal

@DustinCampbell
Copy link
Member

I think I've got a fix for this one.

@YousufAzadSami
Copy link

This wasn't working for me either, which was confusing because Mono is definitely installed. I checked the VSCode settings to see if there's an omnisharp setting. Sure enough, there's a setting omnisharp.useMono that is false by default. I set it to true in my user settings, restarted VS Code, and that fixed the problem for me.

I had to update my mono version to get OmniSharp to use it by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants