dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

reference assemblies for framework were not found. #2093

Closed hasahmed closed 6 years ago

hasahmed commented 6 years ago

The omnisharp part of the extension fails to load. The relevant error message is:


[fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for framework ".NETFramework,Version=v4.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.

Originally vscode prompted me with a message saying that I should download the relevant SDK. I downloaded it but it didn't help. I am attempting to use this with Godot game engine.

Environment data

dotnet --info output:

.NET Command Line Tools (2.1.4)

Product Information:
 Version:            2.1.4
 Commit SHA-1 hash:  5e8add2190

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.4/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.5
  Build    : 17373eb129b3b05aa18ece963f8795d65ef8ea54

VS Code version: Version 1.20.1 C# Extension version: 1.14.0

Steps to reproduce

-Download VsCode -Install Microsoft C# extension -Watch it not work

Expected behavior

C# intellisense

Actual behavior

Extension fails to load screen shot 2018-03-06 at 2 54 48 pm

Here is the output log:

Starting OmniSharp server at 2018-3-6 14:46:21
    Target: /Users/hasankatie/classes/g220/projects/poggle/poggle.sln

OmniSharp server started wth Mono
    Path: /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/run
    PID: 86811

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.13.2 (x64)
[dbug]: OmniSharp.MSBuild.Discovery.Providers.MonoInstanceProvider
        Could not retrieve Mono runtime path
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin"
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Utilities.Core' to '/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Microsoft.Build.Utilities.Core.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Tasks.Core' to '/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Microsoft.Build.Tasks.Core.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Framework' to '/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Microsoft.Build.Framework.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build' to '/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Microsoft.Build.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild
            CscToolPath = /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/hasankatie/classes/g220/projects/poggle'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/hasankatie/classes/g220/projects/poggle
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[dbug]: OmniSharp.MSBuild.ProjectSystem
        MSBuild environment: 
Mode: Standalone
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32: /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin
MSBuildToolsDirectory64: /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin
MSBuildSDKsPath: /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Sdks
CurrentMSBuildConfigurationFile: /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll.config
CurrentMSBuildExePath: /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll
CurrentMSBuildToolsDirectory: /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin
VisualStudioInstallRootDirectory: 
MSBuildExtensionsPath: /Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin

[dbug]: OmniSharp.MSBuild.ProjectLoader
        'MSBuildExtensionsPath' set to '/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild'
[dbug]: OmniSharp.MSBuild.ProjectLoader
        'CscToolPath' set to '/Users/hasankatie/.vscode/extensions/ms-vscode.csharp-1.14.0/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn'
[dbug]: OmniSharp.MSBuild.ProjectLoader
        'CscToolExe' set to 'csc.exe'
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/Users/hasankatie/classes/g220/projects/poggle/poggle.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/hasankatie/classes/g220/projects/poggle/poggle.csproj'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/hasankatie/classes/g220/projects/poggle'.
[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.MSBuild.ProjectManager
        Loading project: /Users/hasankatie/classes/g220/projects/poggle/poggle.csproj
[info]: OmniSharp.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/hasankatie/classes/g220/projects/poggle' on host 86793.
[dbug]: OmniSharp.Stdio.Host
        ************ Request ************
{
  "Type": "request",
  "Seq": 1,
  "Command": "/projects"
}
[dbug]: OmniSharp.Stdio.Host
        ************ Request ************
{
  "Type": "request",
  "Seq": 2,
  "Command": "/projects"
}
[dbug]: OmniSharp.Stdio.Host
        ************ Request ************
{
  "Type": "request",
  "Seq": 3,
  "Command": "/filesChanged",
  "Arguments": [
    {
      "FileName": "/Users/hasankatie/classes/g220/projects/poggle/.git/index.lock",
      "changeType": "Create"
    }
  ]
}
[dbug]: OmniSharp.Stdio.Host
        ************ Request ************
{
  "Type": "request",
  "Seq": 4,
  "Command": "/filesChanged",
  "Arguments": [
    {
      "FileName": "/Users/hasankatie/classes/g220/projects/poggle/.git/index.lock",
      "changeType": "Delete"
    }
  ]
}
[dbug]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 4,
  "Command": "/filesChanged",
  "Running": true,
  "Success": true,
  "Message": null,
  "Body": {},
  "Seq": 39,
  "Type": "response"
}
[dbug]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 3,
  "Command": "/filesChanged",
  "Running": true,
  "Success": true,
  "Message": null,
  "Body": {},
  "Seq": 38,
  "Type": "response"
}
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.Build.resources, Version=15.1.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.Build.resources, Version=15.1.0.0, Culture=en, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.Build.Tasks.Core.resources, Version=15.1.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.Build.Tasks.Core.resources, Version=15.1.0.0, Culture=en, PublicKeyToken=b03f5f7f11d50a3a'
[fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for framework ".NETFramework,Version=v4.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.ProjectManager
        Failed to load project file '/Users/hasankatie/classes/g220/projects/poggle/poggle.csproj'.
/Users/hasankatie/classes/g220/projects/poggle/poggle.csproj

[dbug]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 1,
  "Command": "/projects",
  "Running": true,
  "Success": true,
  "Message": null,
  "Body": {
    "Cake": {
      "Projects": []
    },
    "DotNet": {
      "Projects": [],
      "RuntimePath": null
    },
    "MsBuild": {
      "SolutionPath": "/Users/hasankatie/classes/g220/projects/poggle/poggle.sln",
      "Projects": []
    },
    "Script": {
      "Projects": []
    }
  },
  "Seq": 34,
  "Type": "response"
}
[dbug]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 2,
  "Command": "/projects",
  "Running": true,
  "Success": true,
  "Message": null,
  "Body": {
    "Cake": {
      "Projects": []
    },
    "DotNet": {
      "Projects": [],
      "RuntimePath": null
    },
    "MsBuild": {
      "SolutionPath": "/Users/hasankatie/classes/g220/projects/poggle/poggle.sln",
      "Projects": []
    },
    "Script": {
      "Projects": []
    }
  },
  "Seq": 35,
  "Type": "response"
}
[dbug]: OmniSharp.Stdio.Host
        ************ Request ************
{
  "Type": "request",
  "Seq": 5,
  "Command": "/projects"
}
[dbug]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 5,
  "Command": "/projects",
  "Running": true,
  "Success": true,
  "Message": null,
  "Body": {
    "Cake": {
      "Projects": []
    },
    "DotNet": {
      "Projects": [],
      "RuntimePath": null
    },
    "MsBuild": {
      "SolutionPath": "/Users/hasankatie/classes/g220/projects/poggle/poggle.sln",
      "Projects": []
    },
    "Script": {
      "Projects": []
    }
  },
  "Seq": 52,
  "Type": "response"
}
[dbug]: OmniSharp.Stdio.Host
        ************ Request ************
{
  "Type": "request",
  "Seq": 6,
  "Command": "/filesChanged",
  "Arguments": [
    {
      "FileName": "/Users/hasankatie/Library/Application Support/Code/User/settings.json",
      "changeType": "Change"
    }
  ]
}
[dbug]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 6,
  "Command": "/filesChanged",
  "Running": true,
  "Success": true,
  "Message": null,
  "Body": {},
  "Seq": 55,
  "Type": "response"
}
[dbug]: OmniSharp.Stdio.Host
        ************ Request ************
{
  "Type": "request",
  "Seq": 7,
  "Command": "/filesChanged",
  "Arguments": [
    {
      "FileName": "/Users/hasankatie/Library/Application Support/Code/User/settings.json",
      "changeType": "Change"
    }
  ]
}
[dbug]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 7,
  "Command": "/filesChanged",
  "Running": true,
  "Success": true,
  "Message": null,
  "Body": {},
  "Seq": 58,
  "Type": "response"
}
[dbug]: OmniSharp.Stdio.Host
        ************ Request ************
{
  "Type": "request",
  "Seq": 8,
  "Command": "/filesChanged",
  "Arguments": [
    {
      "FileName": "/Users/hasankatie/Library/Application Support/Code/User/settings.json",
      "changeType": "Change"
    }
  ]
}
[dbug]: OmniSharp.Stdio.Host
        ************  Response ************ 
{
  "Request_seq": 8,
  "Command": "/filesChanged",
  "Running": true,
  "Success": true,
  "Message": null,
  "Body": {},
  "Seq": 61,
  "Type": "response"
}
rchande commented 6 years ago

@hasahmed That error message is asking you to install the .NET Framework 4.5 targeting pack. Since you are on OS X, you need to install Mono to get that targeting pack. Can you try that (http://www.mono-project.com/docs/about-mono/supported-platforms/osx/) and see if it helps?

hasahmed commented 6 years ago

@rchande I have mono installed. This is the output of mono --version

Mono JIT compiler version 5.4.1.7 (2017-06/e66d9abbb27 Wed Oct 25 12:10:41 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           normal
        SIGSEGV:       altstack
        Notification:  kqueue
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          yes(3.6.0svn-mono-master/8b1520c8aae)
        GC:            sgen (concurrent by default)

Its in my PATH and everything. I'm not sure what the issue is.

DustinCampbell commented 6 years ago

@hasahmed. Did you install the full Mono MDK? Or, did you just brew install mono?

DustinCampbell commented 6 years ago

@hasahmed : I recommend that you install the Mono MDK from http://www.mono-project.com/download/stable/ to ensure that you have the latest .NET Framework reference assemblies available for development.