unity vscode omnisharp 报错

 OmniSharp.MSBuild.Discovery.MSBuildLocator

 曾经遇到的坑  =>  报错信息附上: 


 

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.13.6 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Mono 15.0 - "/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin"
            2: StandAlone 15.0 - "/Users/fuliwang/.vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin"
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build' to '/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin/Microsoft.Build.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Utilities.Core' to '/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin/Microsoft.Build.Utilities.Core.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Framework' to '/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin/Microsoft.Build.Framework.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Resolved 'Microsoft.Build.Tasks.Core' to '/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin/Microsoft.Build.Tasks.Core.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 15.0 - "/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin"
            CscToolExe = csc.exe
            CscToolPath = /Users/fuliwang/.vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Roslyn
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
System.TypeLoadException: Could not load type of field 'OmniSharp.MSBuild.ProjectManager:_queue' (9) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,System.RuntimeType/MemberListType)
  at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.RuntimeType+MemberListType listType, System.RuntimeType reflectedType) [0x0001b] in :0 
  at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in :0 
  at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in :0 
  at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00014] in :0 
  at System.Composition.TypedParts.Discovery.TypeInspector+d__7.MoveNext () [0x00030] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector+d__5.MoveNext () [0x000dc] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at OmniSharp.CompositionHostBuilder.Build () [0x00191] in :0 
  at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, Microsoft.Extensions.Configuration.IConfiguration configuration, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x0007e] in <2b6261ffe5a64325b4ca31d51e1800ce>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.
b__1 () [0x00116] in <5fbf8e833fb94e3d93e7569caf9e7b2e>:0 at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.b__0 () [0x0000b] in :0 at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x0035b] in :0 at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable`1[T] args) [0x00042] in :0 at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.
b__0 () [0x00028] in <5fbf8e833fb94e3d93e7569caf9e7b2e>:0 at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in :0

解决办法  参考了一篇链接: https://github.com/OmniSharp/omnisharp-vscode/issues/1004(感谢大佬)

我这装了一个mono    按照链接中的方法   先装xcode工具

1:终端执行:

xcode-select --install) 

2:然后再装 Homebrew(可参考该大神帖子 https://www.cnblogs.com/tian-sun/p/7404358.html)

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3:最后装 mono(终端执行:brew install mono

4:最最后 终端 分别执行   brew unlink mono    brew link mono

问题解决  :

当然还会报那个错     

在vscode 设置里面搜索omnisharp.path  设置一下属性就ok了

"omnisharp.path": "latest",(加不加都可以试试)

5、大功告成!!

 

你可能感兴趣的:(vscode)