question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fails to load Blazor SDK with useModernNet set to true

See original GitHub issue

Environment data

.NET SDK (reflecting any global.json): Version: 6.0.101 Commit: ef49f6213a

Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.101\

Host (useful for support): Version: 6.0.1 Commit: 3a25a7f1cc

.NET SDKs installed: 3.1.300 [C:\Program Files\dotnet\sdk] 6.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download PS C:\Users\User\source\repos\proto-apex-ui>

VS Code version: 1.64.0

C# Extension version:

1.24.0

OmniSharp log

Starting OmniSharp server at 2/7/2022, 5:33:41 PM Target: c:\Users\User\source\repos\proto-apex-ui

OmniSharp server started with .NET 6.0.101 (C:\Program Files\dotnet\sdk\6.0.101). Path: c:\Users\User.vscode\extensions\ms-dotnettools.csharp-1.24.0.omnisharp\1.38.1-beta.65-net6.0\OmniSharp.dll PID: 50036

    Assembly loaded: OmniSharp.DotNetTest
    Loaded OmniSharp.DotNetTest, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
    Assembly loaded: OmniSharp.Host
    Loaded OmniSharp.Host, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
    Assembly loaded: OmniSharp.MSBuild
    Loaded OmniSharp.MSBuild, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
    Assembly loaded: OmniSharp.Roslyn
    Loaded OmniSharp.Roslyn, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
    Assembly loaded: OmniSharp.Roslyn.CSharp
    Loaded OmniSharp.Roslyn.CSharp, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
    Assembly loaded: OmniSharp.Script
    Loaded OmniSharp.Script, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
    Assembly loaded: OmniSharp.Shared
    Loaded OmniSharp.Shared, Version=1.38.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
    Assembly loaded from path: c:\Users\User\.vscode\extensions\ms-dotnettools.csharp-1.24.0\.razor\OmniSharpPlugin\Microsoft.AspNetCore.Razor.OmniSharpPlugin.dll
    Starting OmniSharp on Windows 10.0.19042.0 (x64)
    Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
    Using the 'dotnet' on the PATH.
    DotNetPath set to dotnet
    .NET SDK requires MSBuild instances version 16.3 or higher
    Located 1 MSBuild instance(s)
        1: .NET Core SDK 6.0.101 17.0.0 - "C:\Program Files\dotnet\sdk\6.0.101\"
    MSBuild instance .NET Core SDK 6.0.101 17.0.0 scored at -2147483648
    Registered MSBuild instance: .NET Core SDK 6.0.101 17.0.0 - "C:\Program Files\dotnet\sdk\6.0.101\"
    Assembly loaded: Microsoft.CodeAnalysis.Features, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    Assembly loaded: Microsoft.CodeAnalysis.CSharp.Features, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    Assembly loaded: Microsoft.CodeAnalysis.ExternalAccess.OmniSharp, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    Assembly loaded: Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    Successfully added Microsoft.CodeAnalysis.Features, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 to host service assemblies.
    Successfully added Microsoft.CodeAnalysis.CSharp.Features, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 to host service assemblies.
    Successfully added Microsoft.CodeAnalysis.ExternalAccess.OmniSharp, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 to host service assemblies.
    Successfully added Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 to host service assemblies.
    Successfully added Microsoft.AspNetCore.Razor.OmniSharpPlugin.StrongNamed, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 to host service assemblies.
    Starting with OmniSharp options: {"RoslynExtensionsOptions":{"EnableDecompilationSupport":false,"EnableAnalyzersSupport":false,"EnableImportCompletion":false,"EnableAsyncCompletion":false,"DocumentAnalysisTimeoutMs":30000,"DiagnosticWorkersThreadCount":48,"LocationPaths":null},"FormattingOptions":{"OrganizeImports":false,"EnableEditorConfigSupport":true,"NewLine":"\n","UseTabs":false,"TabSize":4,"IndentationSize":4,"SpacingAfterMethodDeclarationName":false,"SpaceWithinMethodDeclarationParenthesis":false,"SpaceBetweenEmptyMethodDeclarationParentheses":false,"SpaceAfterMethodCallName":false,"SpaceWithinMethodCallParentheses":false,"SpaceBetweenEmptyMethodCallParentheses":false,"SpaceAfterControlFlowStatementKeyword":true,"SpaceWithinExpressionParentheses":false,"SpaceWithinCastParentheses":false,"SpaceWithinOtherParentheses":false,"SpaceAfterCast":false,"SpacesIgnoreAroundVariableDeclaration":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/**/*","**/.git","**/.svn","**/.hg","**/CVS","**/.DS_Store","**/Thumbs.db"],"ExcludeSearchPatterns":[]},"RenameOptions":{"RenameOverloads":false,"RenameInStrings":false,"RenameInComments":false},"ImplementTypeOptions":{"InsertionBehavior":null,"PropertyGenerationBehavior":null},"DotNetCliOptions":{"LocationPaths":null},"Plugins":{"LocationPaths":null}}
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    MSBuild environment: 

Mode: Standalone RunningTests: False RunningInVisualStudio: False MSBuildToolsDirectory32: C:\Program Files\dotnet\sdk\6.0.101 MSBuildToolsDirectory64: C:\Program Files\dotnet\sdk\6.0.101 MSBuildSDKsPath: C:\Program Files\dotnet\sdk\6.0.101
CurrentMSBuildConfigurationFile: C:\Program Files\dotnet\sdk\6.0.101\MSBuild.dll.config CurrentMSBuildExePath: C:\Program Files\dotnet\sdk\6.0.101\MSBuild.dll CurrentMSBuildToolsDirectory: C:\Program Files\dotnet\sdk\6.0.101 VisualStudioInstallRootDirectory: MSBuildExtensionsPath: C:\Program Files\dotnet\sdk\6.0.101

    No solution files found in 'c:\Users\User\source\repos\proto-apex-ui'
    Queue project update for 'c:\Users\User\source\repos\proto-apex-ui\src\proto-apex-ui.csproj'
    Detecting CSX files in 'c:\Users\User\source\repos\proto-apex-ui'.
    Did not find any CSX files
    Configuration finished.
    Omnisharp server running using Stdio at location 'c:\Users\User\source\repos\proto-apex-ui' on host 47032.
    ************ Request ************

{ “Type”: “request”, “Seq”: 1, “Command”: “/projects” } dbug: OmniSharp.Stdio.Host ************ Request ************ { “Type”: “request”, “Seq”: 2, “Command”: “/projects” } info: OmniSharp.MSBuild.ProjectManager Loading project: c:\Users\User\source\repos\proto-apex-ui\src\proto-apex-ui.csproj fail: OmniSharp.MSBuild.ProjectLoader The SDK ‘Microsoft.NET.Sdk.BlazorWebAssembly’ specified could not be found. fail: OmniSharp.MSBuild.ProjectManager Failed to load project file ‘c:\Users\User\source\repos\proto-apex-ui\src\proto-apex-ui.csproj’. Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK ‘Microsoft.NET.Sdk.BlazorWebAssembly’ specified could not be found. c:\Users\User\source\repos\proto-apex-ui\src\proto-apex-ui.csproj at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator4.Evaluate() at Microsoft.Build.Evaluation.Evaluator4.Evaluate(IEvaluatorData4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary1 environmentProperties, ILoggingService loggingService, IItemFactory2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary2 globalProperties, String toolsVersion) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, String toolsVersion) at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary2 projectConfigurationsInSolution, IList1 loggers) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 162 at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary2 configurationsInSolution) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 84 at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader, Guid sessionId, DotNetInfo dotNetInfo) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 117 at OmniSharp.MSBuild.ProjectManager.<>c__DisplayClass32_0.<LoadProject>b__0() in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 305 at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 316 c:\Users\User\source\repos\proto-apex-ui\src\proto-apex-ui.csproj(0,0) Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found. c:\Users\User\source\repos\proto-apex-ui\src\proto-apex-ui.csproj at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator4.Evaluate() at Microsoft.Build.Evaluation.Evaluator4.Evaluate(IEvaluatorData4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary1 environmentProperties, ILoggingService loggingService, IItemFactory2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.Project…ctor(String projectFile, IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary2 globalProperties, String toolsVersion) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, String toolsVersion) at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary2 projectConfigurationsInSolution, IList1 loggers) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 162 at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary2 configurationsInSolution) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 84 at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader, Guid sessionId, DotNetInfo dotNetInfo) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 117 at OmniSharp.MSBuild.ProjectManager.<>c__DisplayClass32_0.<LoadProject>b__0() in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 305 at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 316

    Attempted to update project that is not loaded: c:\Users\User\source\repos\proto-apex-ui\src\proto-apex-ui.csproj
    ************  Response (222.9960ms) ************ 

{ “Request_seq”: 1, “Command”: “/projects”, “Running”: true, “Success”: true, “Message”: null, “Body”: { “MsBuild”: { “SolutionPath”: “c:\Users\User\source\repos\proto-apex-ui”, “Projects”: [] }, “Script”: { “Projects”: [] } }, “Seq”: 46, “Type”: “response” }

Steps to reproduce

Omnisharp settings: “omnisharp.useModernNet”: true, “omnisharp.dotnetPath”: “C:\Program Files\dotnet\sdk\6.0.101”, “omnisharp.path”: “latest”, “omnisharp.loggingLevel”: “trace”

Expected behavior

No error messages; successful load

Actual behavior

Doesn’t seem to be able to find the Blazor SDK. However, the dotnet path seems alright…

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JoeRobichcommented, Feb 8, 2022

The first thing to try is going into Add / Remove programs and performing a repair on your .NET 6 SDK install. If there are still issues you can dump the environment path variable with powershell by invoking echo $env:PATH. It might also be interesting to see the output of dotnet --info from the different environments.

1reaction
JoeRobichcommented, Feb 8, 2022

@AmdJaniga There should be no reason to set the "omnisharp.dotnetPath" unless your dotnet folder hasn’t been added to the PATH environment variable. Try editing your PATH environment variable. Remove C:\Program Files (x86)\dotnet\ if preset and ensure C:\Program Files\dotnet\ is included.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle errors in ASP.NET Core Blazor apps - Microsoft Learn
When the catch block is executed: loadFailed is set to true , which is used to display an error message to the user....
Read more >
omnisharp-vscode - Discover .NET
NET 6 SDK or newer when omnisharp.useModernNet is set to true (the default value). A Full Framework runtime and MSBuild tooling when omnisharp....
Read more >
Hello OmniSharp on .NET 6.0! | StrathWeb. A free flowing web ...
NET 6.0 SDK to be installed on your machine. ... NET 6.0 builds by setting the following in your VS Code settings. {...
Read more >
Debugging Blazor WASM in VS Code fails because of ...
NET Core Debug Blazor Web Assembly in Chrome", "type": "blazorwasm", ... Install and debug with chrome :( Can't get it to work on...
Read more >
What's behind the hype about Blazor? - Stack Overflow Blog
This sets Blazor apart from other UI frameworks such as Angular or ... When the user loads the application a small JavaScript file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found