dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.83k stars 654 forks source link

Could not locate MSBuild instance to register with OmniSharp. #5254

Open yj12138 opened 2 years ago

yj12138 commented 2 years ago

Could not locate MSBuild instance to register with OmniSharp.

JoeRobich commented 2 years ago

@yj12138 If you are running with omnisharp.useModernNet as false then you will need to ensure that MSBuild Tools are installed. See the requirements at https://github.com/OmniSharp/omnisharp-vscode#requirements. We will work on providing a popup to help in this scenario.

vindicatorr commented 2 years ago

I don't know if my case is the same as theirs, but I'm also having an issue with omnisharp finding one of the sdks, but only in the omnisharp extension I built myself (for oss).

6.0 sdk is found, but 7.0-preview is not.

code-insiders:

Starting OmniSharp server at 6/10/2022, 7:08:02 PM
    Target: /<pathToProject>

OmniSharp server started with .NET 7.0.100-preview.4.22252.9
 (/opt/dotnet/dotnet).
    Path: /home/userName/.vscode-insiders/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.omnisharp/1.39.0-net6.0/OmniSharp.dll
    PID: 2569521

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to /opt/dotnet/dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: .NET Core SDK 7.0.100 17.3.0 - "/opt/dotnet/sdk/7.0.100-preview.4.22252.9/"
            2: .NET Core SDK 6.0.200 17.1.0 - "/opt/dotnet/sdk/6.0.200/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 7.0.100 17.3.0 - "/opt/dotnet/sdk/7.0.100-preview.4.22252.9/"
[info]: OmniSharp.WorkspaceInitializer
...

code-oss:

Starting OmniSharp server at 6/10/2022, 7:05:58 PM
    Target: /<pathToProject>

OmniSharp server started with .NET 7.0.100-preview.4.22252.9
 (/opt/dotnet/dotnet).
    Path: /home/userName/.vscode-oss/extensions/ms-dotnettools.csharp-1.25.1/.omnisharp/1.39.0-net6.0/OmniSharp.dll
    PID: 2568360

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: .NET Core SDK 6.0.200 17.1.0 - "/opt/dotnet/sdk/6.0.200/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 6.0.200 17.1.0 - "/opt/dotnet/sdk/6.0.200/"
[info]: OmniSharp.WorkspaceInitializer
...

settings.json: (for both)

...
    "omnisharp.useModernNet": true,
    "omnisharp.dotnetPath": "/opt/dotnet/dotnet",
...

I will say that I did make "some" changes in the omnisharp extension, but solely to get it to build without wiping/downloading the ".{omnisharp,debugger,razor}" components. I manually built Samsung's debugger and downloaded the omnisharp/razor packages.

EDIT0: Uhh, okay, that's weird... I opted to run Omnisharp manually from the cli, and even the "vscode-insiders" extension only pulled 6.0 (whereas 7.0 was also found when the extension ran in code-insiders):

{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.DotNetTest, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":1,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Host, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":2,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.MSBuild, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":3,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Roslyn, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":4,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Roslyn.CSharp, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":5,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Script, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":6,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Shared, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":7,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Starting OmniSharp on Unknown 0.0 (Unknown)"},"Seq":8,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK"},"Seq":9,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"DotNetPath set to /opt/dotnet/dotnet"},"Seq":10,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":".NET SDK requires MSBuild instances version 16.10.0 or higher"},"Seq":11,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Located 1 MSBuild instance(s)\n            1: .NET Core SDK 6.0.200 17.1.0 - \"/opt/dotnet/sdk/6.0.200/\""},"Seq":12,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"MSBuild instance .NET Core SDK 6.0.200 17.1.0 scored at -2147483648"},"Seq":13,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Registered MSBuild instance: .NET Core SDK 6.0.200 17.1.0 - \"/opt/dotnet/sdk/6.0.200/\""},"Seq":14,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.WorkspaceInitializer","Message":"Starting with OmniSharp options: {\"RoslynExtensionsOptions\":{\"EnableDecompilationSupport\":false,\"EnableAnalyzersSupport\":false,\"EnableImportCompletion\":false,\"EnableAsyncCompletion\":false,\"DocumentAnalysisTimeoutMs\":30000,\"DiagnosticWorkersThreadCount\":3,\"AnalyzeOpenDocumentsOnly\":false,\"InlayHintsOptions\":{\"EnableForParameters\":false,\"ForLiteralParameters\":false,\"ForIndexerParameters\":false,\"ForObjectCreationParameters\":false,\"ForOtherParameters\":false,\"SuppressForParametersThatDifferOnlyBySuffix\":false,\"SuppressForParametersThatMatchMethodIntent\":false,\"SuppressForParametersThatMatchArgumentName\":false,\"EnableForTypes\":false,\"ForImplicitVariableTypes\":false,\"ForLambdaParameterTypes\":false,\"ForImplicitObjectCreation\":false},\"LocationPaths\":null},\"FormattingOptions\":{\"OrganizeImports\":false,\"EnableEditorConfigSupport\":false,\"NewLine\":\"\\n\",\"UseTabs\":false,\"TabSize\":4,\"IndentationSize\":4,\"SpacingAfterMethodDeclarationName\":false,\"SeparateImportDirectiveGroups\":false,\"SpaceWithinMethodDeclarationParenthesis\":false,\"SpaceBetweenEmptyMethodDeclarationParentheses\":false,\"SpaceAfterMethodCallName\":false,\"SpaceWithinMethodCallParentheses\":false,\"SpaceBetweenEmptyMethodCallParentheses\":false,\"SpaceAfterControlFlowStatementKeyword\":true,\"SpaceWithinExpressionParentheses\":false,\"SpaceWithinCastParentheses\":false,\"SpaceWithinOtherParentheses\":false,\"SpaceAfterCast\":false,\"SpaceBeforeOpenSquareBracket\":false,\"SpaceBetweenEmptySquareBrackets\":false,\"SpaceWithinSquareBrackets\":false,\"SpaceAfterColonInBaseTypeDeclaration\":true,\"SpaceAfterComma\":true,\"SpaceAfterDot\":false,\"SpaceAfterSemicolonsInForStatement\":true,\"SpaceBeforeColonInBaseTypeDeclaration\":true,\"SpaceBeforeComma\":false,\"SpaceBeforeDot\":false,\"SpaceBeforeSemicolonsInForStatement\":false,\"SpacingAroundBinaryOperator\":\"single\",\"IndentBraces\":false,\"IndentBlock\":true,\"IndentSwitchSection\":true,\"IndentSwitchCaseSection\":true,\"IndentSwitchCaseSectionWhenBlock\":true,\"LabelPositioning\":\"oneLess\",\"WrappingPreserveSingleLine\":true,\"WrappingKeepStatementsOnSingleLine\":true,\"NewLinesForBracesInTypes\":true,\"NewLinesForBracesInMethods\":true,\"NewLinesForBracesInProperties\":true,\"NewLinesForBracesInAccessors\":true,\"NewLinesForBracesInAnonymousMethods\":true,\"NewLinesForBracesInControlBlocks\":true,\"NewLinesForBracesInAnonymousTypes\":true,\"NewLinesForBracesInObjectCollectionArrayInitializers\":true,\"NewLinesForBracesInLambdaExpressionBody\":true,\"NewLineForElse\":true,\"NewLineForCatch\":true,\"NewLineForFinally\":true,\"NewLineForMembersInObjectInit\":true,\"NewLineForMembersInAnonymousTypes\":true,\"NewLineForClausesInQuery\":true},\"FileOptions\":{\"SystemExcludeSearchPatterns\":[\"**/node_modules/**/*\",\"**/bin/**/*\",\"**/obj/**/*\",\"**/.git/**/*\"],\"ExcludeSearchPatterns\":[]},\"RenameOptions\":{\"RenameOverloads\":false,\"RenameInStrings\":false,\"RenameInComments\":false},\"ImplementTypeOptions\":{\"InsertionBehavior\":0,\"PropertyGenerationBehavior\":0},\"DotNetCliOptions\":{\"LocationPaths\":null},\"Plugins\":{\"LocationPaths\":null}}"},"Seq":15,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.WorkspaceInitializer","Message":"Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0"},"Seq":16,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.MSBuild.ProjectSystem","Message":"MSBuild environment: \nMode: Standalone\nRunningTests: False\nRunningInVisualStudio: False\nMSBuildToolsDirectory32: /opt/dotnet/sdk/6.0.200\nMSBuildToolsDirectory64: /opt/dotnet/sdk/6.0.200\nMSBuildSDKsPath: /opt/dotnet/sdk/6.0.200/Sdks\nCurrentMSBuildConfigurationFile: /opt/dotnet/sdk/6.0.200/MSBuild.dll.config\nCurrentMSBuildExePath: /opt/dotnet/sdk/6.0.200/MSBuild.dll\nCurrentMSBuildToolsDirectory: /opt/dotnet/sdk/6.0.200\nVisualStudioInstallRootDirectory: \nMSBuildExtensionsPath: /opt/dotnet/sdk/6.0.200\n"},"Seq":17,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectSystem","Message":"No solution files found in '/<pathToProject>'"},"Seq":18,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Queue project update for '/<pathToProject>/console/console.csproj'"},"Seq":19,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Queue project update for '/<pathToProject>/library/library.csproj'"},"Seq":20,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Script.ScriptProjectSystem","Message":"Detecting CSX files in '/<pathToProject>'."},"Seq":21,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Script.ScriptProjectSystem","Message":"Did not find any CSX files"},"Seq":22,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.WorkspaceInitializer","Message":"Configuration finished."},"Seq":23,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Omnisharp server running using Stdio at location '/<pathToProject>' on host -1."},"Seq":24,"Type":"event"}
{"Event":"started","Body":null,"Seq":25,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Loading project: /<pathToProject>/console/console.csproj"},"Seq":26,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Successfully loaded project file '/<pathToProject>/console/console.csproj'."},"Seq":27,"Type":"event"}
{"Event":"MsBuildProjectDiagnostics","Body":{"FileName":"/<pathToProject>/console/console.csproj","Warnings":[],"Errors":[]},"Seq":28,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Adding project '/<pathToProject>/console/console.csproj'"},"Seq":29,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Loading project: /<pathToProject>/library/library.csproj"},"Seq":30,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Successfully loaded project file '/<pathToProject>/library/library.csproj'."},"Seq":31,"Type":"event"}
{"Event":"MsBuildProjectDiagnostics","Body":{"FileName":"/<pathToProject>/library/library.csproj","Warnings":[],"Errors":[]},"Seq":32,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Adding project '/<pathToProject>/library/library.csproj'"},"Seq":33,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Update project: console"},"Seq":34,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.MSBuild.ProjectManager","Message":".editorconfig files were configured by the project console but will not be respected because the feature is switched off in OmniSharp. Enable .editorconfig support in OmniSharp to take advantage of them."},"Seq":35,"Type":"event"}
{"Event":"ProjectConfiguration","Body":{"ProjectId":"928d748282274d60","SessionId":"271435400","OutputKind":0,"ProjectCapabilities":["GenerateDocumentationFile","CSharp","Managed","ReferencesFolder","LanguageService","RelativePathDerivedDefaultNamespace","AssemblyReferences","COMReferences","ProjectReferences","SharedProjectReferences","OutputGroups","AllTargetOutputGroups","VisualStudioWellKnownOutputGroups","SingleFileGenerators","DeclaredSourceItems","UserSourceItems","CrossPlatformExecutable","SupportsHotReload","Pack"],"TargetFrameworks":["net7.0"],"SdkVersion":"-1103605569","References":[],"FileExtensions":["-1257278712"],"FileCounts":[3]},"Seq":36,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Update project: library"},"Seq":37,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.MSBuild.ProjectManager","Message":".editorconfig files were configured by the project library but will not be respected because the feature is switched off in OmniSharp. Enable .editorconfig support in OmniSharp to take advantage of them."},"Seq":38,"Type":"event"}
{"Event":"ProjectConfiguration","Body":{"ProjectId":"59e7e900f2902a73","SessionId":"271435400","OutputKind":2,"ProjectCapabilities":["GenerateDocumentationFile","CSharp","Managed","ReferencesFolder","LanguageService","RelativePathDerivedDefaultNamespace","AssemblyReferences","COMReferences","ProjectReferences","SharedProjectReferences","OutputGroups","AllTargetOutputGroups","VisualStudioWellKnownOutputGroups","SingleFileGenerators","DeclaredSourceItems","UserSourceItems","SupportsHotReload","Pack"],"TargetFrameworks":["net7.0"],"SdkVersion":"-1103605569","References":[],"FileExtensions":["-1257278712","-338936554"],"FileCounts":[3,1]},"Seq":39,"Type":"event"}
{"Event":"ProjectAdded","Body":{"MsBuildProject":{"ProjectGuid":"00000000-0000-0000-0000-000000000000","Path":"/<pathToProject>/console/console.csproj","AssemblyName":"console","TargetPath":"/<pathToProject>/console/bin/Debug/net7.0/console.dll","TargetFramework":".NETCoreApp,Version=v7.0","SourceFiles":["/<pathToProject>/console/storjConsole.cs","/<pathToProject>/console/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs","/<pathToProject>/console/obj/Debug/net7.0/console.AssemblyInfo.cs"],"TargetFrameworks":[{"Name":".NETCoreApp","FriendlyName":".NETCoreApp","ShortName":"net7.0"}],"OutputPath":"bin\\Debug/net7.0/","IntermediateOutputPath":"obj\\Debug/net7.0/","Configuration":"Debug","Platform":"AnyCPU","IsExe":true,"IsUnityProject":false}},"Seq":40,"Type":"event"}
{"Event":"ProjectAdded","Body":{"MsBuildProject":{"ProjectGuid":"00000000-0000-0000-0000-000000000000","Path":"/<pathToProject>/library/library.csproj","AssemblyName":"library","TargetPath":"/<pathToProject>/library/bin/Debug/net7.0/library.dll","TargetFramework":".NETCoreApp,Version=v7.0","SourceFiles":["/<pathToProject>/library/storjClass.cs","/<pathToProject>/library/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs","/<pathToProject>/library/obj/Debug/net7.0/library.AssemblyInfo.cs"],"TargetFrameworks":[{"Name":".NETCoreApp","FriendlyName":".NETCoreApp","ShortName":"net7.0"}],"OutputPath":"bin\\Debug/net7.0/","IntermediateOutputPath":"obj\\Debug/net7.0/","Configuration":"Debug","Platform":"AnyCPU","IsExe":false,"IsUnityProject":false}},"Seq":41,"Type":"event"}
{"Event":"ProjectChanged","Body":{"MsBuildProject":{"ProjectGuid":"00000000-0000-0000-0000-000000000000","Path":"/<pathToProject>/console/console.csproj","AssemblyName":"console","TargetPath":"/<pathToProject>/console/bin/Debug/net7.0/console.dll","TargetFramework":".NETCoreApp,Version=v7.0","SourceFiles":["/<pathToProject>/console/storjConsole.cs","/<pathToProject>/console/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs","/<pathToProject>/console/obj/Debug/net7.0/console.AssemblyInfo.cs"],"TargetFrameworks":[{"Name":".NETCoreApp","FriendlyName":".NETCoreApp","ShortName":"net7.0"}],"OutputPath":"bin\\Debug/net7.0/","IntermediateOutputPath":"obj\\Debug/net7.0/","Configuration":"Debug","Platform":"AnyCPU","IsExe":true,"IsUnityProject":false}},"Seq":42,"Type":"event"}
{"Event":"ProjectChanged","Body":{"MsBuildProject":{"ProjectGuid":"00000000-0000-0000-0000-000000000000","Path":"/<pathToProject>/library/library.csproj","AssemblyName":"library","TargetPath":"/<pathToProject>/library/bin/Debug/net7.0/library.dll","TargetFramework":".NETCoreApp,Version=v7.0","SourceFiles":["/<pathToProject>/library/storjClass.cs","/<pathToProject>/library/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs","/<pathToProject>/library/obj/Debug/net7.0/library.AssemblyInfo.cs"],"TargetFrameworks":[{"Name":".NETCoreApp","FriendlyName":".NETCoreApp","ShortName":"net7.0"}],"OutputPath":"bin\\Debug/net7.0/","IntermediateOutputPath":"obj\\Debug/net7.0/","Configuration":"Debug","Platform":"AnyCPU","IsExe":false,"IsUnityProject":false}},"Seq":43,"Type":"event"}

EDIT1: ACK! I'm a dummy... I downloaded the wrong omnisharp roslyn package (mono, not core). Although I will say that running the command in the terminal still only picks up the 1 sdk (6.0), but not the other (7.0) (Located 1 MSBuild instance(s)\n 1: .NET Core SDK 6.0.200...):

$ dotnet ~/.vscode-oss/extensions/ms-dotnettools.csharp-1.25.1/.omnisharp/1.39.0-net6.0/OmniSharp.dll -v
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.DotNetTest, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":1,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Host, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":2,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.MSBuild, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":3,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Roslyn, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":4,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Roslyn.CSharp, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":5,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Script, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":6,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"Loaded OmniSharp.Shared, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509"},"Seq":7,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Starting OmniSharp on Unknown 0.0 (Unknown)"},"Seq":8,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK"},"Seq":9,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"DotNetPath set to /opt/dotnet/dotnet"},"Seq":10,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":".NET SDK requires MSBuild instances version 16.10.0 or higher"},"Seq":11,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Located 1 MSBuild instance(s)\n            1: .NET Core SDK 6.0.200 17.1.0 - \"/opt/dotnet/sdk/6.0.200/\""},"Seq":12,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.CompositionHostBuilder","Message":"MSBuild instance .NET Core SDK 6.0.200 17.1.0 scored at -2147483648"},"Seq":13,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Registered MSBuild instance: .NET Core SDK 6.0.200 17.1.0 - \"/opt/dotnet/sdk/6.0.200/\""},"Seq":14,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.WorkspaceInitializer","Message":"Starting with OmniSharp options: {\"RoslynExtensionsOptions\":{\"EnableDecompilationSupport\":false,\"EnableAnalyzersSupport\":false,\"EnableImportCompletion\":false,\"EnableAsyncCompletion\":false,\"DocumentAnalysisTimeoutMs\":30000,\"DiagnosticWorkersThreadCount\":3,\"AnalyzeOpenDocumentsOnly\":false,\"InlayHintsOptions\":{\"EnableForParameters\":false,\"ForLiteralParameters\":false,\"ForIndexerParameters\":false,\"ForObjectCreationParameters\":false,\"ForOtherParameters\":false,\"SuppressForParametersThatDifferOnlyBySuffix\":false,\"SuppressForParametersThatMatchMethodIntent\":false,\"SuppressForParametersThatMatchArgumentName\":false,\"EnableForTypes\":false,\"ForImplicitVariableTypes\":false,\"ForLambdaParameterTypes\":false,\"ForImplicitObjectCreation\":false},\"LocationPaths\":null},\"FormattingOptions\":{\"OrganizeImports\":false,\"EnableEditorConfigSupport\":false,\"NewLine\":\"\\n\",\"UseTabs\":false,\"TabSize\":4,\"IndentationSize\":4,\"SpacingAfterMethodDeclarationName\":false,\"SeparateImportDirectiveGroups\":false,\"SpaceWithinMethodDeclarationParenthesis\":false,\"SpaceBetweenEmptyMethodDeclarationParentheses\":false,\"SpaceAfterMethodCallName\":false,\"SpaceWithinMethodCallParentheses\":false,\"SpaceBetweenEmptyMethodCallParentheses\":false,\"SpaceAfterControlFlowStatementKeyword\":true,\"SpaceWithinExpressionParentheses\":false,\"SpaceWithinCastParentheses\":false,\"SpaceWithinOtherParentheses\":false,\"SpaceAfterCast\":false,\"SpaceBeforeOpenSquareBracket\":false,\"SpaceBetweenEmptySquareBrackets\":false,\"SpaceWithinSquareBrackets\":false,\"SpaceAfterColonInBaseTypeDeclaration\":true,\"SpaceAfterComma\":true,\"SpaceAfterDot\":false,\"SpaceAfterSemicolonsInForStatement\":true,\"SpaceBeforeColonInBaseTypeDeclaration\":true,\"SpaceBeforeComma\":false,\"SpaceBeforeDot\":false,\"SpaceBeforeSemicolonsInForStatement\":false,\"SpacingAroundBinaryOperator\":\"single\",\"IndentBraces\":false,\"IndentBlock\":true,\"IndentSwitchSection\":true,\"IndentSwitchCaseSection\":true,\"IndentSwitchCaseSectionWhenBlock\":true,\"LabelPositioning\":\"oneLess\",\"WrappingPreserveSingleLine\":true,\"WrappingKeepStatementsOnSingleLine\":true,\"NewLinesForBracesInTypes\":true,\"NewLinesForBracesInMethods\":true,\"NewLinesForBracesInProperties\":true,\"NewLinesForBracesInAccessors\":true,\"NewLinesForBracesInAnonymousMethods\":true,\"NewLinesForBracesInControlBlocks\":true,\"NewLinesForBracesInAnonymousTypes\":true,\"NewLinesForBracesInObjectCollectionArrayInitializers\":true,\"NewLinesForBracesInLambdaExpressionBody\":true,\"NewLineForElse\":true,\"NewLineForCatch\":true,\"NewLineForFinally\":true,\"NewLineForMembersInObjectInit\":true,\"NewLineForMembersInAnonymousTypes\":true,\"NewLineForClausesInQuery\":true},\"FileOptions\":{\"SystemExcludeSearchPatterns\":[\"**/node_modules/**/*\",\"**/bin/**/*\",\"**/obj/**/*\",\"**/.git/**/*\"],\"ExcludeSearchPatterns\":[]},\"RenameOptions\":{\"RenameOverloads\":false,\"RenameInStrings\":false,\"RenameInComments\":false},\"ImplementTypeOptions\":{\"InsertionBehavior\":0,\"PropertyGenerationBehavior\":0},\"DotNetCliOptions\":{\"LocationPaths\":null},\"Plugins\":{\"LocationPaths\":null}}"},"Seq":15,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.WorkspaceInitializer","Message":"Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0"},"Seq":16,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.MSBuild.ProjectSystem","Message":"MSBuild environment: \nMode: Standalone\nRunningTests: False\nRunningInVisualStudio: False\nMSBuildToolsDirectory32: /opt/dotnet/sdk/6.0.200\nMSBuildToolsDirectory64: /opt/dotnet/sdk/6.0.200\nMSBuildSDKsPath: /opt/dotnet/sdk/6.0.200/Sdks\nCurrentMSBuildConfigurationFile: /opt/dotnet/sdk/6.0.200/MSBuild.dll.config\nCurrentMSBuildExePath: /opt/dotnet/sdk/6.0.200/MSBuild.dll\nCurrentMSBuildToolsDirectory: /opt/dotnet/sdk/6.0.200\nVisualStudioInstallRootDirectory: \nMSBuildExtensionsPath: /opt/dotnet/sdk/6.0.200\n"},"Seq":17,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectSystem","Message":"No solution files found in '/<pathToProject>'"},"Seq":18,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Queue project update for '/<pathToProject>/console/console.csproj'"},"Seq":19,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Queue project update for '/<pathToProject>/library/library.csproj'"},"Seq":20,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Script.ScriptProjectSystem","Message":"Detecting CSX files in '/<pathToProject>'."},"Seq":21,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Script.ScriptProjectSystem","Message":"Did not find any CSX files"},"Seq":22,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.WorkspaceInitializer","Message":"Configuration finished."},"Seq":23,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Omnisharp server running using Stdio at location '/<pathToProject>' on host -1."},"Seq":24,"Type":"event"}
{"Event":"started","Body":null,"Seq":25,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Loading project: /<pathToProject>/console/console.csproj"},"Seq":26,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Successfully loaded project file '/<pathToProject>/console/console.csproj'."},"Seq":27,"Type":"event"}
{"Event":"MsBuildProjectDiagnostics","Body":{"FileName":"/<pathToProject>/console/console.csproj","Warnings":[],"Errors":[]},"Seq":28,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Adding project '/<pathToProject>/console/console.csproj'"},"Seq":29,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Loading project: /<pathToProject>/library/library.csproj"},"Seq":30,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Successfully loaded project file '/<pathToProject>/library/library.csproj'."},"Seq":31,"Type":"event"}
{"Event":"MsBuildProjectDiagnostics","Body":{"FileName":"/<pathToProject>/library/library.csproj","Warnings":[],"Errors":[]},"Seq":32,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Adding project '/<pathToProject>/library/library.csproj'"},"Seq":33,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Update project: console"},"Seq":34,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.MSBuild.ProjectManager","Message":".editorconfig files were configured by the project console but will not be respected because the feature is switched off in OmniSharp. Enable .editorconfig support in OmniSharp to take advantage of them."},"Seq":35,"Type":"event"}
{"Event":"ProjectConfiguration","Body":{"ProjectId":"928d748282274d60","SessionId":"-1949606537","OutputKind":0,"ProjectCapabilities":["GenerateDocumentationFile","CSharp","Managed","ReferencesFolder","LanguageService","RelativePathDerivedDefaultNamespace","AssemblyReferences","COMReferences","ProjectReferences","SharedProjectReferences","OutputGroups","AllTargetOutputGroups","VisualStudioWellKnownOutputGroups","SingleFileGenerators","DeclaredSourceItems","UserSourceItems","CrossPlatformExecutable","SupportsHotReload","Pack"],"TargetFrameworks":["net7.0"],"SdkVersion":"-1103605569","References":[],"FileExtensions":["-1257278712"],"FileCounts":[3]},"Seq":36,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.ProjectManager","Message":"Update project: library"},"Seq":37,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"DEBUG","Name":"OmniSharp.MSBuild.ProjectManager","Message":".editorconfig files were configured by the project library but will not be respected because the feature is switched off in OmniSharp. Enable .editorconfig support in OmniSharp to take advantage of them."},"Seq":38,"Type":"event"}
{"Event":"ProjectConfiguration","Body":{"ProjectId":"59e7e900f2902a73","SessionId":"-1949606537","OutputKind":2,"ProjectCapabilities":["GenerateDocumentationFile","CSharp","Managed","ReferencesFolder","LanguageService","RelativePathDerivedDefaultNamespace","AssemblyReferences","COMReferences","ProjectReferences","SharedProjectReferences","OutputGroups","AllTargetOutputGroups","VisualStudioWellKnownOutputGroups","SingleFileGenerators","DeclaredSourceItems","UserSourceItems","SupportsHotReload","Pack"],"TargetFrameworks":["net7.0"],"SdkVersion":"-1103605569","References":[],"FileExtensions":["-1257278712","-338936554"],"FileCounts":[3,1]},"Seq":39,"Type":"event"}
{"Event":"ProjectChanged","Body":{"MsBuildProject":{"ProjectGuid":"00000000-0000-0000-0000-000000000000","Path":"/<pathToProject>/console/console.csproj","AssemblyName":"console","TargetPath":"/<pathToProject>/console/bin/Debug/net7.0/console.dll","TargetFramework":".NETCoreApp,Version=v7.0","SourceFiles":["/<pathToProject>/console/storjConsole.cs","/<pathToProject>/console/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs","/<pathToProject>/console/obj/Debug/net7.0/console.AssemblyInfo.cs"],"TargetFrameworks":[{"Name":".NETCoreApp","FriendlyName":".NETCoreApp","ShortName":"net7.0"}],"OutputPath":"bin\\Debug/net7.0/","IntermediateOutputPath":"obj\\Debug/net7.0/","Configuration":"Debug","Platform":"AnyCPU","IsExe":true,"IsUnityProject":false}},"Seq":40,"Type":"event"}
{"Event":"ProjectAdded","Body":{"MsBuildProject":{"ProjectGuid":"00000000-0000-0000-0000-000000000000","Path":"/<pathToProject>/console/console.csproj","AssemblyName":"console","TargetPath":"/<pathToProject>/console/bin/Debug/net7.0/console.dll","TargetFramework":".NETCoreApp,Version=v7.0","SourceFiles":["/<pathToProject>/console/storjConsole.cs","/<pathToProject>/console/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs","/<pathToProject>/console/obj/Debug/net7.0/console.AssemblyInfo.cs"],"TargetFrameworks":[{"Name":".NETCoreApp","FriendlyName":".NETCoreApp","ShortName":"net7.0"}],"OutputPath":"bin\\Debug/net7.0/","IntermediateOutputPath":"obj\\Debug/net7.0/","Configuration":"Debug","Platform":"AnyCPU","IsExe":true,"IsUnityProject":false}},"Seq":41,"Type":"event"}
{"Event":"ProjectAdded","Body":{"MsBuildProject":{"ProjectGuid":"00000000-0000-0000-0000-000000000000","Path":"/<pathToProject>/library/library.csproj","AssemblyName":"library","TargetPath":"/<pathToProject>/library/bin/Debug/net7.0/library.dll","TargetFramework":".NETCoreApp,Version=v7.0","SourceFiles":["/<pathToProject>/library/storjClass.cs","/<pathToProject>/library/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs","/<pathToProject>/library/obj/Debug/net7.0/library.AssemblyInfo.cs"],"TargetFrameworks":[{"Name":".NETCoreApp","FriendlyName":".NETCoreApp","ShortName":"net7.0"}],"OutputPath":"bin\\Debug/net7.0/","IntermediateOutputPath":"obj\\Debug/net7.0/","Configuration":"Debug","Platform":"AnyCPU","IsExe":false,"IsUnityProject":false}},"Seq":42,"Type":"event"}
{"Event":"ProjectChanged","Body":{"MsBuildProject":{"ProjectGuid":"00000000-0000-0000-0000-000000000000","Path":"/<pathToProject>/library/library.csproj","AssemblyName":"library","TargetPath":"/<pathToProject>/library/bin/Debug/net7.0/library.dll","TargetFramework":".NETCoreApp,Version=v7.0","SourceFiles":["/<pathToProject>/library/storjClass.cs","/<pathToProject>/library/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs","/<pathToProject>/library/obj/Debug/net7.0/library.AssemblyInfo.cs"],"TargetFrameworks":[{"Name":".NETCoreApp","FriendlyName":".NETCoreApp","ShortName":"net7.0"}],"OutputPath":"bin\\Debug/net7.0/","IntermediateOutputPath":"obj\\Debug/net7.0/","Configuration":"Debug","Platform":"AnyCPU","IsExe":false,"IsUnityProject":false}},"Seq":43,"Type":"event"}

whereas in vscode, the log shows both:

Located 2 MSBuild instance(s)
            1: .NET Core SDK 7.0.100 17.3.0 - "/opt/dotnet/sdk/7.0.100-preview.4.22252.9/"
            2: .NET Core SDK 6.0.200...
JoeRobich commented 2 years ago

@vindicatorr Since I cannot know the exact changes you made, all I can say is that the discovery of preview SDKs is controlled by passing the SDK IncludePrereleases option to OmniSharp on startup. The C# extension will do this if the sdkIncludePrereleases settings is enabled.

https://github.com/OmniSharp/omnisharp-vscode/blob/58b95a6ca64679ddbae8e466253ba47a6db5dee2/src/omnisharp/server.ts#L410-L412

vindicatorr commented 2 years ago

Yup! That would explain the discrepancy in the cli output. After appending "Sdk:IncludePrereleases=true" to the end of the dotnet ...OmniSharp.dll command, it found the prerelease.

no149 commented 1 year ago

On Ubuntu, I downgraded the C# extension of VSCode (which includes Omnisharp) from 1.25 to 1.24 and it worked.