带有 asp.net 核心 1.1 应用程序的 omnisharp
omnisharp with asp.net core 1.1 app
我正在尝试在 vi (neovim)
中完成 asp.net 核心 1.1 应用程序的代码
这是 omnisharp 服务器 + vim 插件:
https://github.com/OmniSharp/Omnisharp-vim
在我的 .vimrc 中我添加了这个:
Plug 'OmniSharp/omnisharp-vim'
let g:OmniSharp_server_type = 'roslyn'
(我想我需要 roslyn 用于 .net 核心?)
我也没有错误地克隆和编译了 omnisharp roslyn 服务器。
但是当我启动 OmniSharp 时,我得到这个错误:
/.local/share/nvim/plugged/omnisharp-vim/omnisharp-roslyn> ./artifacts/scripts/OmniSharp
OmniSharp:
System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys:GetUnixNamePrivate ()
at Interop+Sys.GetUnixName () [0x00000] in <2c0705c248b844f597694acdb70b3a23>:0
at System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform (System.Runtime.InteropServices.OSPlatform osPlatform) [0x00009] in <2c0705c248b844f597694acdb70b3a23>:0
at Microsoft.Extensions.Logging.Console.ConsoleLogger..ctor (System.String name, System.Func`3[T1,T2,TResult] filter, System.Boolean includeScopes) [0x00051] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.CreateLoggerImplementation (System.String name) [0x00019] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in <a33fd236349b4603bef9951b0ab37965>:0
at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.CreateLogger (System.String name) [0x00000] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at Microsoft.Extensions.Logging.Logger.AddProvider (Microsoft.Extensions.Logging.ILoggerProvider provider) [0x00000] in <6ac0afe55b53462283fd4e4f8f1658ac>:0
at Microsoft.Extensions.Logging.LoggerFactory.AddProvider (Microsoft.Extensions.Logging.ILoggerProvider provider) [0x00061] in <6ac0afe55b53462283fd4e4f8f1658ac>:0
at Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsole (Microsoft.Extensions.Logging.ILoggerFactory factory, System.Func`3[T1,T2,TResult] filter, System.Boolean includeScopes) [0x00008] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsole (Microsoft.Extensions.Logging.ILoggerFactory factory, System.Func`3[T1,T2,TResult] filter) [0x00000] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at OmniSharp.Startup.Configure (Microsoft.AspNetCore.Builder.IApplicationBuilder app, System.IServiceProvider serviceProvider, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.Services.IAssemblyLoader loader, Microsoft.Extensions.Options.IOptionsMonitor`1[TOptions] options) [0x00032] in <8853ad029e4d47c0b478044425f4b3a3>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <a33fd236349b4603bef9951b0ab37965>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <a33fd236349b4603bef9951b0ab37965>:0
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure (Microsoft.AspNetCore.Builder.IApplicationBuilder app) [0x00027] in <24af31b64ae843689736582353a19b3a>:0
at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.<Configure>b__0 (Microsoft.AspNetCore.Builder.IApplicationBuilder builder) [0x0000d] in <24af31b64ae843689736582353a19b3a>:0
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication () [0x00080] in <24af31b64ae843689736582353a19b3a>:0
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize () [0x00008] in <24af31b64ae843689736582353a19b3a>:0
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build () [0x0008a] in <24af31b64ae843689736582353a19b3a>:0
at OmniSharp.Program+<>c__DisplayClass1_0.<Run>b__1 () [0x00196] in <8853ad029e4d47c0b478044425f4b3a3>:0
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x0035b] in <e56ebbc3ed87488b8e26736bbadaa5d3>:0
at OmniSharp.Program.Run (System.String[] args) [0x001ae] in <8853ad029e4d47c0b478044425f4b3a3>:0
at OmniSharp.Program.Main (System.String[] args) [0x0001c] in <8853ad029e4d47c0b478044425f4b3a3>:0
这里是一些版本信息:
~> dotnet --info
.NET Command Line Tools (1.0.4)
Product Information:
Version: 1.0.4
Commit SHA-1 hash: af1e6684fd
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/1.0.4
~> mono --version
Mono JIT compiler version 5.2.0.209 (2017-04/3d531ba Mon Jul 3 12:16:03 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/8b1520c)
GC: sgen (concurrent by default)
~>
为什么我还需要 Mono? dotnet core 还不够吗?
dotnet core 是否仅适用于 Roslyn?
vscode 用于 c# 完成的是什么?罗斯林?
这里可能是什么问题?
更新:
我从 roslyn 文件夹 (~/.local/share/nvim/plugged/omnisharp-vim/omnisharp-roslyn) 进行了发布,如下所示:'dotnet publish -c Release -f netcoreapp1.1'
然后我将文件从发布文件夹 (~/.local/share/nvim/plugged/omnisharp-vim/omnisharp-roslyn/artifacts/publish/OmniSharp/default/netcoreapp1.1) 复制到脚本文件夹 (~/.local/share/nvim/plugged/omnisharp-vim/omnisharp-roslyn/工件/脚本)。
不确定这是否是正确的解决方案,但它似乎有效。
更新 2:
最后我刚从这里下载了一个版本:https://github.com/OmniSharp/omnisharp-roslyn/releases
然后我将 omnisharp-vim/omnisharp-roslyn/artifacts/scripts/OmniSharp 更改为如下内容:
#!/bin/bash
"/<path>/omnisharp-vim/omnisharp-osx-x64-netcoreapp1.1/Omnisharp" "$@"
现在可以使用了
通常出现System.DllNotFoundException: System.Native
异常是因为你刚刚复制了编译文件夹,那是错误的,你必须发布应用程序然后使用该文件夹中的文件,应用程序需要的所有库都在那里运行.
我正在尝试在 vi (neovim)
中完成 asp.net 核心 1.1 应用程序的代码这是 omnisharp 服务器 + vim 插件: https://github.com/OmniSharp/Omnisharp-vim
在我的 .vimrc 中我添加了这个:
Plug 'OmniSharp/omnisharp-vim'
let g:OmniSharp_server_type = 'roslyn'
(我想我需要 roslyn 用于 .net 核心?)
我也没有错误地克隆和编译了 omnisharp roslyn 服务器。
但是当我启动 OmniSharp 时,我得到这个错误:
/.local/share/nvim/plugged/omnisharp-vim/omnisharp-roslyn> ./artifacts/scripts/OmniSharp
OmniSharp:
System.DllNotFoundException: System.Native
at (wrapper managed-to-native) Interop+Sys:GetUnixNamePrivate ()
at Interop+Sys.GetUnixName () [0x00000] in <2c0705c248b844f597694acdb70b3a23>:0
at System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform (System.Runtime.InteropServices.OSPlatform osPlatform) [0x00009] in <2c0705c248b844f597694acdb70b3a23>:0
at Microsoft.Extensions.Logging.Console.ConsoleLogger..ctor (System.String name, System.Func`3[T1,T2,TResult] filter, System.Boolean includeScopes) [0x00051] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.CreateLoggerImplementation (System.String name) [0x00019] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in <a33fd236349b4603bef9951b0ab37965>:0
at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.CreateLogger (System.String name) [0x00000] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at Microsoft.Extensions.Logging.Logger.AddProvider (Microsoft.Extensions.Logging.ILoggerProvider provider) [0x00000] in <6ac0afe55b53462283fd4e4f8f1658ac>:0
at Microsoft.Extensions.Logging.LoggerFactory.AddProvider (Microsoft.Extensions.Logging.ILoggerProvider provider) [0x00061] in <6ac0afe55b53462283fd4e4f8f1658ac>:0
at Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsole (Microsoft.Extensions.Logging.ILoggerFactory factory, System.Func`3[T1,T2,TResult] filter, System.Boolean includeScopes) [0x00008] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at Microsoft.Extensions.Logging.ConsoleLoggerExtensions.AddConsole (Microsoft.Extensions.Logging.ILoggerFactory factory, System.Func`3[T1,T2,TResult] filter) [0x00000] in <e9a418d09ae748d6a3f11d651b9e1106>:0
at OmniSharp.Startup.Configure (Microsoft.AspNetCore.Builder.IApplicationBuilder app, System.IServiceProvider serviceProvider, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.Services.IAssemblyLoader loader, Microsoft.Extensions.Options.IOptionsMonitor`1[TOptions] options) [0x00032] in <8853ad029e4d47c0b478044425f4b3a3>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <a33fd236349b4603bef9951b0ab37965>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <a33fd236349b4603bef9951b0ab37965>:0
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure (Microsoft.AspNetCore.Builder.IApplicationBuilder app) [0x00027] in <24af31b64ae843689736582353a19b3a>:0
at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter+<>c__DisplayClass0_0.<Configure>b__0 (Microsoft.AspNetCore.Builder.IApplicationBuilder builder) [0x0000d] in <24af31b64ae843689736582353a19b3a>:0
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication () [0x00080] in <24af31b64ae843689736582353a19b3a>:0
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize () [0x00008] in <24af31b64ae843689736582353a19b3a>:0
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build () [0x0008a] in <24af31b64ae843689736582353a19b3a>:0
at OmniSharp.Program+<>c__DisplayClass1_0.<Run>b__1 () [0x00196] in <8853ad029e4d47c0b478044425f4b3a3>:0
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x0035b] in <e56ebbc3ed87488b8e26736bbadaa5d3>:0
at OmniSharp.Program.Run (System.String[] args) [0x001ae] in <8853ad029e4d47c0b478044425f4b3a3>:0
at OmniSharp.Program.Main (System.String[] args) [0x0001c] in <8853ad029e4d47c0b478044425f4b3a3>:0
这里是一些版本信息:
~> dotnet --info
.NET Command Line Tools (1.0.4)
Product Information:
Version: 1.0.4
Commit SHA-1 hash: af1e6684fd
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/1.0.4
~> mono --version
Mono JIT compiler version 5.2.0.209 (2017-04/3d531ba Mon Jul 3 12:16:03 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/8b1520c)
GC: sgen (concurrent by default)
~>
为什么我还需要 Mono? dotnet core 还不够吗?
dotnet core 是否仅适用于 Roslyn?
vscode 用于 c# 完成的是什么?罗斯林?
这里可能是什么问题?
更新:
我从 roslyn 文件夹 (~/.local/share/nvim/plugged/omnisharp-vim/omnisharp-roslyn) 进行了发布,如下所示:'dotnet publish -c Release -f netcoreapp1.1'
然后我将文件从发布文件夹 (~/.local/share/nvim/plugged/omnisharp-vim/omnisharp-roslyn/artifacts/publish/OmniSharp/default/netcoreapp1.1) 复制到脚本文件夹 (~/.local/share/nvim/plugged/omnisharp-vim/omnisharp-roslyn/工件/脚本)。
不确定这是否是正确的解决方案,但它似乎有效。
更新 2:
最后我刚从这里下载了一个版本:https://github.com/OmniSharp/omnisharp-roslyn/releases
然后我将 omnisharp-vim/omnisharp-roslyn/artifacts/scripts/OmniSharp 更改为如下内容:
#!/bin/bash
"/<path>/omnisharp-vim/omnisharp-osx-x64-netcoreapp1.1/Omnisharp" "$@"
现在可以使用了
通常出现System.DllNotFoundException: System.Native
异常是因为你刚刚复制了编译文件夹,那是错误的,你必须发布应用程序然后使用该文件夹中的文件,应用程序需要的所有库都在那里运行.