注意:我已经搜索了与OmniSharp问题相关的其他类似问题,找不到合适的解决方案.vs代码c#的智能感知无法正常工作。我卸载了c#扩展名并再次安装,但是它不能解决我的问题。我还安装了早期版本的csharp 1.15.2,但它不起作用。我附上我的日志信息
我的dotnet --info如下
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
1.1.14 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\microsoft.AspNetCore.All]
microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\microsoft.AspNetCore.App]
microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\microsoft.AspNetCore.App]
microsoft.NETCore.App 1.0.16 [C:\Program Files\dotnet\shared\microsoft.NETCore.App]
microsoft.NETCore.App 1.1.13 [C:\Program Files\dotnet\shared\microsoft.NETCore.App]
microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\microsoft.NETCore.App]
microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\microsoft.NETCore.App]
microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
我的日志如下
Starting OmniSharp server at 10/12/2019,8:51:54 am
Target: e:\Nebula Materials\Nebula\Nebula.sln
OmniSharp server started.
Path: C:\Users\aliimran.MREMIND\.vscode\extensions\ms-vscode.csharp-1.21.8\.omnisharp\1.34.8\OmniSharp.exe
PID: 17160
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Community 2019 16.3.29411.108 - "C:\Program Files (x86)\microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
2: StandAlone 16.3 - "C:\Users\aliimran.MREMIND\.vscode\extensions\ms-vscode.csharp-1.21.8\.omnisharp\1.34.8\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Community 2019 16.3.29411.108 - "C:\Program Files (x86)\microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'e:\Nebula Materials\Nebula'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in 'e:\Nebula Materials\Nebula\Nebula.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'e:\Nebula Materials\Nebula\Nebula.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'e:\Nebula Materials\Nebula'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider,Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: e:\Nebula Materials\Nebula\Nebula.csproj
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider,Order: 100
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider,Order: 200
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'e:\Nebula Materials\Nebula' on host 18328.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file 'e:\Nebula Materials\Nebula\Nebula.csproj'.
e:\Nebula Materials\Nebula\Nebula.csproj(1,1)
microsoft.build.Exceptions.InvalidProjectFileException: The imported project "C:\Program Files (x86)\microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\microsoft.Common.CurrentVersion.targets" was not found. Confirm that the path in the <Import> declaration is correct,and that the file exists on disk. C:\Program Files (x86)\microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\microsoft.Common.targets
at microsoft.build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName,IElementLocation elementLocation,String resourceName,Object[] args)
at microsoft.build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1](IElementLocation elementLocation,T1 arg0)
at microsoft.build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpression(String directoryOfImportingFile,ProjectImportElement importElement,String unescapedExpression,Boolean throwOnFileNotExistsError,List`1& imports)
at microsoft.build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile,List`1& projects,SdkResult& sdkResult,Boolean throwOnFileNotExistsError)
at microsoft.build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile,SdkResult& sdkResult)
at microsoft.build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile,ProjectImportElement importElement)
at microsoft.build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at microsoft.build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile,ProjectImportElement importElement)
at microsoft.build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at microsoft.build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService,BuildEventContext buildEventContext)
at microsoft.build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation,ProjectLoadSettings loadSettings,EvaluationContext evaluationContext)
at microsoft.build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation,EvaluationContext evaluationContext)
at microsoft.build.Evaluation.Project.Initialize(IDictionary`2 globalProperties,String toolsVersion,String subToolsetVersion,EvaluationContext evaluationContext)
at microsoft.build.Evaluation.Project..ctor(String projectFile,IDictionary`2 globalProperties,ProjectCollection projectCollection,EvaluationContext evaluationContext)
at microsoft.build.Evaluation.ProjectCollection.LoadProject(String fileName,String toolsVersion)
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 129
at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 72
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath,ProjectIdInfo projectIdInfo,ProjectLoader loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 98
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath,Func`1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 308
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: e:\Nebula Materials\Nebula\Nebula.csproj