Omnisharp-vscode: Omnisharp fails to load project file in VSCode with Unity

Created on 12 Jun 2017  路  9Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output: (ran from terminal - don't believe I have this installed) zsh: command not found: dotnet
VS Code version: 1.13.0
C# Extension version: 1.10.0
Mono version: mono --version
Mono JIT compiler version 5.0.1.1 (2017-02/5077205 Thu May 18 16:11:37 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com

Steps to reproduce

1) Have Unity, VSCode, C# Extension, Mono installed.
2) Open script from Unity. It will launch VSCode.
3) Behavior described in Actual behavior occurs.

Expected behavior

Project should load correctly without error messages, provide intellisense.

Actual behavior

No Intellisense and VSCode prompts me with this message: WARN Some projects have trouble loading. Please review the output for more details.

Things I've tried:

  • Updated and reinstalled mono
  • Looked at other issues for this project, including #1031 . However, I've added mono to my path (see above) and it's able to find it no problem.
  • Installing .NET Core. This didn't seem to have any effect so uninstalled it. (that's why dotnet --info from command line says it's not found. Had it working earlier). Is this needed?

OmniSharp logs

Starting OmniSharp server at 6/12/2017, 8:22:41 AM
    Target: /Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/UnityClient.sln

OmniSharp server started wth Mono
    Path: /Users/jarrods/.vscode/extensions/ms-vscode.csharp-1.10.0/bin/run
    PID: 52221

OmniSharp: -s /Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/UnityClient.sln --hostPID 52196 --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 '/Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient' on host 52196."},"Seq":1,"Type":"event"}
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient
[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
        MSBUILD_EXE_PATH environment variable set to /Users/jarrods/.vscode/extensions/ms-vscode.csharp-1.10.0/bin/omnisharp/msbuild/MSBuild.dll
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuildExtensionsPath environment variable set to /Users/jarrods/.vscode/extensions/ms-vscode.csharp-1.10.0/bin/omnisharp/msbuild
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        MSBuild will use local OmniSharp installation.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/UnityClient.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.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.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/Assembly-CSharp.csproj'.
/Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/Assembly-CSharp.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/Assembly-CSharp-Editor.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.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.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/Assembly-CSharp-Editor.csproj'.
/Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient/Assembly-CSharp-Editor.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/jarrods/fcgs/fcgs/src/FCGS/UnityClient'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Startup
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Startup
        Configuration finished.

Thoughts on what's wrong?

Most helpful comment

Hello,

I've updated to latest mono and I still get this error.

All 9 comments

Tried one more thing after posting this - I had a strange setup with zshenv instead of zshrc. Moving my PATH info to zshrc instead fixed the problem.

I'm running into this issue suddenly with 1.15.0. Can you elaborate on what PATH info you mean, @Redmage3555 ?

@dpeaveybnea: Are you certain you're seeing this precise issue (i.e. have you checked your OmniSharp Log to see if if you're getting the same failures)?

With the latest C# for VS Code that we shipped yesterday, the latest stable Mono (5.0.1) is required. I'm betting that's what you're running into and updating Mono will address the problem. See also:

I am not sure, so I will check this out. If its better for context, the bulk of the work I do is in the context of Unity 5.

Cheers.

The version of Unity shouldn't have any impact on this issue. It's the Mono version installed on your development machine that's critical to C# for VS Code.

If you find that you're seeing a different problem than what's described in the issues I linked to, please file a separate issue.

Your note was right on the money, @DustinCampbell. Thanks for the help.

Excellent! I'm glad you've got it working!

Hello,

I've updated to latest mono and I still get this error.

@TobiasDev : It's probably better to file a new issue that necro a closed one.

Was this page helpful?
0 / 5 - 0 ratings