当前位置:   article > 正文

unity vscode omnisharp 报错_omnisharp.msbuild.discovery.msbuildlocator

omnisharp.msbuild.discovery.msbuildlocator

 OmniSharp.MSBuild.Discovery.MSBuildLocator

unresolve .... unityeditor.dll。。。

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


  1. [info]: OmniSharp.Stdio.Host
  2. Starting OmniSharp on MacOS 10.13.6 (x64)
  3. [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
  4. Located 2 MSBuild instance(s)
  5. 1: Mono 15.0 - "/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin"
  6. 2: StandAlone 15.0 - "/Users/fuliwang/.vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin"
  7. [dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
  8. Resolved 'Microsoft.Build' to '/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin/Microsoft.Build.dll'
  9. [dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
  10. 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'
  11. [dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
  12. Resolved 'Microsoft.Build.Framework' to '/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin/Microsoft.Build.Framework.dll'
  13. [dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
  14. 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'
  15. [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
  16. Registered MSBuild instance: Mono 15.0 - "/usr/local/Cellar/mono/5.20.1.19/lib/mono/msbuild/15.0/bin"
  17. CscToolExe = csc.exe
  18. CscToolPath = /Users/fuliwang/.vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/omnisharp/msbuild/15.0/Bin/Roslyn
  19. [dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
  20. Attempting to resolve 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
  21. [dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
  22. Attempting to resolve 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
  23. 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.
  24. at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,System.RuntimeType/MemberListType)
  25. at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.RuntimeType+MemberListType listType, System.RuntimeType reflectedType) [0x0001b] in <c53df17215fa414b83bb28114b62b37f>:0
  26. at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in <c53df17215fa414b83bb28114b62b37f>:0
  27. at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in <c53df17215fa414b83bb28114b62b37f>:0
  28. at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00014] in <c53df17215fa414b83bb28114b62b37f>:0
  29. at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverPropertyExports>d__7.MoveNext () [0x00030] in <9aac21a4a3f24063b2b8b59143acddfc>:0
  30. at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverExports>d__5.MoveNext () [0x000dc] in <9aac21a4a3f24063b2b8b59143acddfc>:0
  31. at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <9aac21a4a3f24063b2b8b59143acddfc>:0
  32. at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <9aac21a4a3f24063b2b8b59143acddfc>:0
  33. at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <9aac21a4a3f24063b2b8b59143acddfc>:0
  34. at OmniSharp.CompositionHostBuilder.Build () [0x00191] in <e53c2b752e604319bef1c55a5946377a>:0
  35. 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
  36. at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__1 () [0x00116] in <5fbf8e833fb94e3d93e7569caf9e7b2e>:0
  37. at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.<OnExecute>b__0 () [0x0000b] in <e53c2b752e604319bef1c55a5946377a>:0
  38. at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x0035b] in <e56ebbc3ed87488b8e26736bbadaa5d3>:0
  39. at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable`1[T] args) [0x00042] in <e53c2b752e604319bef1c55a5946377a>:0
  40. at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__0 () [0x00028] in <5fbf8e833fb94e3d93e7569caf9e7b2e>:0
  41. at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <e53c2b752e604319bef1c55a5946377a>: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、大功告成!!

6:如果遇到unresolve .... unityeditor.dll。。。 等问题 

说明c#版本与unity package 里面的版本不一致

https://zhuanlan.zhihu.com/p/245846735

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/904741
推荐阅读
相关标签
  

闽ICP备14008679号