weixin_39889792
weixin_39889792
2020-11-29 02:21

Omnisharp crashes if it can't find a .NET Framework version

Environment data

dotnet --info output:


dotnet --info
.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

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/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version: 1.19.0-insiders C# Extension version: 1.13.1

Steps to reproduce

  1. clone this repo: http://github.com/powershell/powershelleditorservices on a mac or linux
  2. open the repo in VSCode with the C# extension installed

NOTE: This repo targets multiple different versions of .NET (net451, net452, netstandard1.6)

Expected behavior

Omnisharp would do a best effort load of the projects and load them with the versions of .NET available

Actual behavior

Omnisharp crashes with the following errors:


Starting OmniSharp server at 12/22/2017, 9:59:26 AM
    Target: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/PowerShellEditorServices.sln

OmniSharp server started wth Mono
    Path: /Users/tylerleonhardt/.vscode-insiders/extensions/ms-vscode.csharp-1.13.1/.omnisharp/run
    PID: 28616

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.12.6 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/Users/tylerleonhardt/.vscode-insiders/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/Users/tylerleonhardt/.vscode-insiders/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/Users/tylerleonhardt/.vscode-insiders/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /Users/tylerleonhardt/.vscode-insiders/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild
            CscToolPath = /Users/tylerleonhardt/.vscode-insiders/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/tylerleonhardt/.vscode-insiders/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/PowerShellEditorServices.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj
[warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Microsoft.NETCore.Portable.Compatibility 1.0.3-beta-24514-00 depends on Microsoft.NETCore.Runtime.CoreCLR (>= 1.0.2-beta-24512-03) but Microsoft.NETCore.Runtime.CoreCLR 1.0.2-beta-24512-03 was not found. An approximate best match of Microsoft.NETCore.Runtime.CoreCLR 1.0.2-rc2-23818 was resolved.
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Assets file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices/obj/project.assets.json' doesn't have a target for '.NETFramework,Version=v4.5.1'. Ensure that restore has run and that you have included 'net451' in the TargetFrameworks for your project.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj'.
/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices/PowerShellEditorServices.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.Host/PowerShellEditorServices.Host.csproj
[warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Microsoft.NETCore.Portable.Compatibility 1.0.3-beta-24514-00 depends on Microsoft.NETCore.Runtime.CoreCLR (>= 1.0.2-beta-24512-03) but Microsoft.NETCore.Runtime.CoreCLR 1.0.2-beta-24512-03 was not found. An approximate best match of Microsoft.NETCore.Runtime.CoreCLR 1.0.2-rc2-23818 was resolved.
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Assets file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.Host/obj/project.assets.json' doesn't have a target for '.NETFramework,Version=v4.5.1'. Ensure that restore has run and that you have included 'net451' in the TargetFrameworks for your project.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.Host/PowerShellEditorServices.Host.csproj'.
/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.Host/PowerShellEditorServices.Host.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Host/PowerShellEditorServices.Test.Host.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        The reference assemblies for framework ".NETFramework,Version=v4.5.2" 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.MSBuildProjectSystem
        Failed to load project file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Host/PowerShellEditorServices.Test.Host.csproj'.
/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Host/PowerShellEditorServices.Test.Host.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        The reference assemblies for framework ".NETFramework,Version=v4.5.2" 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.MSBuildProjectSystem
        Failed to load project file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj'.
/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Shared/PowerShellEditorServices.Test.Shared.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        The reference assemblies for framework ".NETFramework,Version=v4.5.2" 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.MSBuildProjectSystem
        Failed to load project file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Shared/PowerShellEditorServices.Test.Shared.csproj'.
/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Shared/PowerShellEditorServices.Test.Shared.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.Protocol/PowerShellEditorServices.Protocol.csproj
[warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Microsoft.NETCore.Portable.Compatibility 1.0.3-beta-24514-00 depends on Microsoft.NETCore.Runtime.CoreCLR (>= 1.0.2-beta-24512-03) but Microsoft.NETCore.Runtime.CoreCLR 1.0.2-beta-24512-03 was not found. An approximate best match of Microsoft.NETCore.Runtime.CoreCLR 1.0.2-rc2-23818 was resolved.
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Assets file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.Protocol/obj/project.assets.json' doesn't have a target for '.NETFramework,Version=v4.5.1'. Ensure that restore has run and that you have included 'net451' in the TargetFrameworks for your project.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.Protocol/PowerShellEditorServices.Protocol.csproj'.
/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.Protocol/PowerShellEditorServices.Protocol.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Protocol/PowerShellEditorServices.Test.Protocol.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        The reference assemblies for framework ".NETFramework,Version=v4.5.2" 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.MSBuildProjectSystem
        Failed to load project file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Protocol/PowerShellEditorServices.Test.Protocol.csproj'.
/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.Protocol/PowerShellEditorServices.Test.Protocol.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.csproj
[warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Microsoft.NETCore.Portable.Compatibility 1.0.3-beta-24514-00 depends on Microsoft.NETCore.Runtime.CoreCLR (>= 1.0.2-beta-24512-03) but Microsoft.NETCore.Runtime.CoreCLR 1.0.2-beta-24512-03 was not found. An approximate best match of Microsoft.NETCore.Runtime.CoreCLR 1.0.2-rc2-23818 was resolved.
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Assets file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.VSCode/obj/project.assets.json' doesn't have a target for '.NETFramework,Version=v4.5.1'. Ensure that restore has run and that you have included 'net451' in the TargetFrameworks for your project.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.csproj'.
/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices/src/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices'.
[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.Stdio.Host
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/tylerleonhardt/Desktop/CompSci/PowerShell/vscode/PowerShellEditorServices' on host 28500.

This just means I can't use VSCode for this project on my mac because I lose out on intellisense, etc.

该提问来源于开源项目:OmniSharp/omnisharp-vscode

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

9条回答

为你推荐