Closed AmdJaniga closed 2 years ago
@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.
Thanks Joe.
Removed it, however, same result so far.
Updated FIle:
Log:
The SDK 'Microsoft.NET.Sdk.BlazorWebAssembly' specified could not be found.
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.
Frankly, I'm not sure if this is an omnisharp issue or not. As a shot in the dark I tried to run dotnet watch --project src/proto-apex-ui.csproj
in the powershell terminal in VSCode. I got the same error.
What I'm confused with is that it builds just find in a PowerShell terminal outside of VSCode.
I'm obviously not the most .net experienced person and I appreciate the help.
How do I go about dumping the build env in each location to determine what is different?
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.
Okay... still having the issue and my PATH and dotnet --info are identical despite they behave differently.
@AmdJaniga I see the Windows PowerShell is running as Administrator. Does dotnet watch
find the SDK when not running an admin shell?
Great catch!
That's it, fails when not running as an administrator.
Any idea where I should take this observation? Doesn't seem to be an issue with omnisharp...
@AmdJaniga It might be simplest to uninstall and reinstall the .NET 6 sdk. Ensuring your user isn't elevated prior to running the installer.
Thanks, makes sense. I'll close this issue.
And thanks for your help!
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
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
{ "Type": "request", "Seq": 1, "Command": "/projects" }
{ "Type": "request", "Seq": 2, "Command": "/projects" }
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.Evaluatorb0() in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 305
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Funcb 0() in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 305
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 316
4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List
1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError) at Microsoft.Build.Evaluation.Evaluator4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) at Microsoft.Build.Evaluation.Evaluator
4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator
4.Evaluate() at Microsoft.Build.Evaluation.Evaluator4.Evaluate(IEvaluatorData
4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary1 environmentProperties, ILoggingService loggingService, IItemFactory
2 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, IDictionary
2 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, IReadOnlyDictionary
2 projectConfigurationsInSolution, IList1 loggers) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 162 at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary
2 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.<>cDisplayClass32_0.1 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.Evaluator
4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError) at Microsoft.Build.Evaluation.Evaluator
4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult) at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator
4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport) at Microsoft.Build.Evaluation.Evaluator4.Evaluate() at Microsoft.Build.Evaluation.Evaluator
4.Evaluate(IEvaluatorData4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary
1 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(IDictionary
2 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, IDictionary
2 globalProperties, String toolsVersion) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, String toolsVersion) at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary2 projectConfigurationsInSolution, IList
1 loggers) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 162 at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary`2 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.<>cDisplayClass32_0.{ "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...