dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 675 forks source link

Project Failed to Load error #5024

Closed jtsom closed 5 days ago

jtsom commented 2 years ago

Issue Description

After turning on "omnisharp.useModernNet" option, the project fails to load, with an error:

The specified task executable location "c:\Program Files\dotnet\dotnet" is invalid.

Steps to Reproduce

Launch VSCode with .Net 6 project.

Expected Behavior

No errors

Actual Behavior

Error reported above

Logs

OmniSharp log

Starting OmniSharp server at 1/24/2022, 4:36:24 PM Target: c:\Users\jtsombakos\source\FHIR Test\FHIR Test OmniSharp server started with .NET 6.0.200-preview.22055.15 . Path: c:\Users\jtsombakos\.vscode-insiders\extensions\ms-dotnettools.csharp-1.24.0\.omnisharp\1.38.0-net6.0\OmniSharp.dll PID: 10284 [info]: OmniSharp.Stdio.Host Starting OmniSharp on Windows 10.0.19044.0 (x64) [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 2 MSBuild instance(s) 1: .NET Core SDK 6.0.200 17.1.0 - "C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15\" 2: .NET Core SDK 6.0.101 17.0.0 - "C:\Program Files\dotnet\sdk\6.0.101\" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: .NET Core SDK 6.0.200 17.1.0 - "C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15\" [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0 [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.ImplementTypeWorkspaceOptionsProvider, Order: 110 [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140 [info]: OmniSharp.MSBuild.ProjectSystem No solution files found in 'c:\Users\jtsombakos\source\FHIR Test\FHIR Test' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'c:\Users\jtsombakos\source\FHIR Test\FHIR Test\FHIR Test.csproj' [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in 'c:\Users\jtsombakos\source\FHIR Test\FHIR Test'. [info]: OmniSharp.Script.ScriptProjectSystem Did not find any CSX files [info]: OmniSharp.WorkspaceInitializer Configuration finished. [info]: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location 'c:\Users\jtsombakos\source\FHIR Test\FHIR Test' on host 13720. [info]: OmniSharp.MSBuild.ProjectManager Loading project: c:\Users\jtsombakos\source\FHIR Test\FHIR Test\FHIR Test.csproj [fail]: OmniSharp.MSBuild.ProjectLoader The specified task executable location "c:\Program Files\dotnet\dotnet" is invalid. [warn]: OmniSharp.MSBuild.ProjectManager Failed to load project file 'c:\Users\jtsombakos\source\FHIR Test\FHIR Test\FHIR Test.csproj'. c:\Users\jtsombakos\source\FHIR Test\FHIR Test\FHIR Test.csproj C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15\Roslyn\Microsoft.CSharp.Core.targets(75,5): Error: The specified task executable location "c:\Program Files\dotnet\dotnet" is invalid. [fail]: OmniSharp.MSBuild.ProjectManager Attempted to update project that is not loaded: c:\Users\jtsombakos\source\FHIR Test\FHIR Test\FHIR Test.csproj [info]: OmniSharp.OmniSharpWorkspace Miscellaneous file: c:\Users\jtsombakos\source\FHIR Test\FHIR Test\obj\Debug\net6.0\FHIR Test.AssemblyInfo.cs added to workspace

C# log

Installing C# dependencies... Platform: win32, x86_64 Downloading package 'OmniSharp for Windows (.NET 6 / x64)' (38364 KB).................... Done! Validating download... Integrity Check succeeded. Installing package 'OmniSharp for Windows (.NET 6 / x64)' Finished

Environment information

VSCode version: 1.64.0-insider C# Extension: 1.24.0

Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.200-preview.22055.15 Commit: a3c3a2bf3b Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15\ Host (useful for support): Version: 6.0.1 Commit: 3a25a7f1cc .NET SDKs installed: 5.0.404 [C:\Program Files\dotnet\sdk] 6.0.101 [C:\Program Files\dotnet\sdk] 6.0.200-preview.22055.15 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.13 [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 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.13 [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.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.13 [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
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |azure-account|ms-vscode|0.9.11| |csharp|ms-dotnettools|1.24.0| |git-graph|mhutchie|1.30.0| |hexeditor|ms-vscode|1.9.3| |hl7tools|RobHolme|1.13.2| |material-icon-theme|PKief|4.12.1| |msbuild-project-tools|tintoy|0.4.3| |night-owl|sdras|2.0.1| |quicktype|quicktype|12.0.46| |sync-scroll|dqisme|1.3.0| |TabOut|albert|0.2.1| |vs-code-xml-format|fabianlauer|0.1.5| |vscode-azurefunctions|ms-azuretools|1.6.0| |vscode-azureresourcegroups|ms-azuretools|0.4.0| |vscode-azurestorage|ms-azuretools|0.12.1| |vscode-base64|adamhartford|0.1.0| |vscode-thunder-client|rangav|1.10.0| |vscodeintellicode|VisualStudioExptTeam|1.2.15|;
filipw commented 2 years ago

This seems really like a dotnet SDK issue not an OmniSharp issue.

You can try the suggestion mentioned here https://github.com/dotnet/aspnetcore/issues/27990#issuecomment-733868864

jtsom commented 2 years ago

No, this is a omnisharp-vscode issue, as the directions I followed are from this project:

https://github.com/OmniSharp/omnisharp-vscode/releases

filipw commented 2 years ago

The error in your log is only displayed by OmniSharp but is coming from the MSBuild included in the dotnet SDK.

JoeRobich commented 5 days ago

A lot has changed with O# sdk resolution since this issue was opened. If you are still having problems, please open a new issue at https://github.com/omnisharp/omnisharp-roslyn/issues