dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 669 forks source link

"The command "dotnet tool list --local" exited with code 9009." for monogame dotnet template. #3957

Open vycdev opened 4 years ago

vycdev commented 4 years ago

Issue Description

Intelisense doesn't work with the monogame template.

Steps to Reproduce

  1. Create a new folder and use the dotnet new mgdesktopgl (template from dotnet new -i MonoGame.Template.CSharp)
  2. See that omnisharp isn't working.

Expected Behavior

Omnisharp shouldn't give me an error and the everything should work.

Actual Behavior

Doesn't work, it throws an error.

OmniSharp log

Starting OmniSharp server at 8/9/2020, 4:33:51 PM Target: d:\GitHUB\Monogameprojects\MGTestProject OmniSharp server started. Path: C:\Users\Vycto\.vscode\extensions\ms-dotnettools.csharp-1.21.18\.omnisharp\1.35.5-beta.80\OmniSharp.exe PID: 14108 [info]: OmniSharp.Stdio.Host Starting OmniSharp on Windows 6.2.9200.0 (x64) [info]: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 2 MSBuild instance(s) 1: Visual Studio Community 2019 16.6.30320.27 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" 2: StandAlone 16.4 - "C:\Users\Vycto\.vscode\extensions\ms-dotnettools.csharp-1.21.18\.omnisharp\1.35.5-beta.80\.msbuild\Current\Bin" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: Visual Studio Community 2019 16.6.30320.27 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" [info]: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in 'd:\GitHUB\Monogameprojects\MGTestProject'. [info]: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files [info]: OmniSharp.MSBuild.ProjectSystem No solution files found in 'd:\GitHUB\Monogameprojects\MGTestProject' [info]: OmniSharp.MSBuild.ProjectManager Queue project update for 'd:\GitHUB\Monogameprojects\MGTestProject\MGTestProject.csproj' [info]: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in 'd:\GitHUB\Monogameprojects\MGTestProject'. [info]: OmniSharp.Script.ScriptProjectSystem Could not find any CSX files [info]: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 [info]: OmniSharp.MSBuild.ProjectManager Loading project: d:\GitHUB\Monogameprojects\MGTestProject\MGTestProject.csproj [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.WorkspaceInitializer Configuration finished. [info]: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location 'd:\GitHUB\Monogameprojects\MGTestProject' on host 13712. [fail]: OmniSharp.MSBuild.ProjectLoader The command "dotnet tool list --local" exited with code 9009. [warn]: OmniSharp.MSBuild.ProjectManager Failed to load project file 'd:\GitHUB\Monogameprojects\MGTestProject\MGTestProject.csproj'. d:\GitHUB\Monogameprojects\MGTestProject\MGTestProject.csproj C:\Users\Vycto\.nuget\packages\monogame.content.builder.task\3.8.0.1375-develop\build\MonoGame.Content.Builder.Task.targets(46,5): Error: The command "dotnet tool list --local" exited with code 9009. [fail]: OmniSharp.MSBuild.ProjectManager Attempted to update project that is not loaded: d:\GitHUB\Monogameprojects\MGTestProject\MGTestProject.csproj

C# log

Getting latest OmniSharp version information Downloading package 'Latest OmniSharp Version Information' (1 KB).................... Done!

Environment information

VSCode version: 1.43.0 C# Extension: 1.21.18

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.302 Commit: 41faccf259 Runtime Environment: OS Name: Windows OS Version: 10.0.18362 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.302\ Host (useful for support): Version: 3.1.6 Commit: 3acd9b0cd1 .NET Core SDKs installed: 3.1.302 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |auto-rename-tag|formulahendry|0.1.4| |bracket-pair-colorizer|CoenraadS|1.0.61| |color-highlight|naumovs|2.3.0| |csharp|ms-dotnettools|1.21.18| |csharpfixformat|Leopotam|0.0.84| |dhall-lang|panaeon|0.0.4| |discord-vscode|icrawl|3.13.0| |EditorConfig|EditorConfig|0.15.1| |html-preview-vscode|tht13|0.2.5| |ide-purescript|nwolverson|0.20.15| |JavaScriptSnippets|xabikos|1.8.0| |language-purescript|nwolverson|0.2.4| |LiveServer|ritwickdey|5.6.1| |material-icon-theme|PKief|4.2.0| |monogame-pipeline-vscode|abcdef|0.0.2| |node-module-intellisense|leizongmin|1.5.0| |npm-intellisense|christian-kohler|1.3.0| |path-intellisense|christian-kohler|2.2.1| |prettier-vscode|esbenp|5.1.3| |python|ms-python|2020.5.86806| |remote-wsl|ms-vscode-remote|0.42.4| |rtf|alefragnani|2.1.0| |slime|smlombardi|3.2.1| |theme-material-theme|jprestidge|1.0.1| |vsc-community-material-theme|Equinusocio|1.4.1| |vsc-material-theme|Equinusocio|32.8.0| |vsc-material-theme-icons|equinusocio|1.2.0| |vscode-autohotkey|slevesque|0.2.2| |vscode-eslint|dbaeumer|2.1.8| |vscode-icons|vscode-icons-team|10.2.0| |vscode-styled-components|jpoissonnier|0.0.29| |vscode-surround|yatki|1.0.2| |vscode-todo-plus|fabiospampinato|4.17.1| |vscode-wakatime|WakaTime|4.0.0| |vsliveshare|ms-vsliveshare|1.0.2478|;

Other details

What bothers me is the:

[fail]: OmniSharp.MSBuild.ProjectLoader
        The command "dotnet tool list --local" exited with code 9009.

part of the log. I tried to search for it on the internet but no result.

I also want to mention that I am new at C# and idk much about it. I tried using visual studio at first but it just seems too bloated/heavy for me. I wanted to use vscode because it's already my main editor.

Other things I have tried:

In the ~/.omnisharp/omnisharp.json I tried putting this:

{
  "MsBuild": {
    "UseLegacySdkResolver": true
  }
}

Nothing changed, perhaps the sdk thingy isn't the problem idk again I am new at this stuff and I don't fully understand how it works. Another thing I tried was putting

"omnisharp.path": "latest"

in settings.json.

One more thing

I tried to see if the same problem occurs with other dotnet templates. Well I only tried one more which is dotnet new console and I had no problems with omnisharp in there (at least nothing that would cause the extension to fail).

cartermp commented 4 years ago

This sounds like an issue with the template and not the plugin. The error comes from targets in the template:

MonoGame.Content.Builder.Task.targets

These targets from the template are what appear to be calling the dotnet command.

I tried installing these sample templates - dotnet new -i MonoGame.Template.CSharp but it didn't give me the same one you mentioned. Is there more info you could supply here about the template you installed? Does it build via dotnet build outside of VSCode?