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 fails to load project file in VSCode with Unity #1563

Closed
Redmage3555 opened this issue Jun 12, 2017 · 9 comments
Closed

Omnisharp fails to load project file in VSCode with Unity #1563

Redmage3555 opened this issue Jun 12, 2017 · 9 comments

Comments

@Redmage3555
Copy link

Redmage3555 commented Jun 12, 2017

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 OmniSharp cannot locate Mono when using Z shell on macOS #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?

@Redmage3555
Copy link
Author

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.

@dpeaveybnea
Copy link

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

@DustinCampbell
Copy link
Member

@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:

@dpeaveybnea
Copy link

dpeaveybnea commented Aug 11, 2017 via email

@DustinCampbell
Copy link
Member

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.

@dpeaveybnea
Copy link

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

@DustinCampbell
Copy link
Member

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

@TobiasDev
Copy link

Hello,

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

@DustinCampbell
Copy link
Member

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

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

No branches or pull requests

4 participants