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.

The terminal shell path "dotnet" is a directory

See original GitHub issue

Issue Description

Cant run “build” task because “The preLaunchTask ‘build’ terminated with exit code -2.”

I’ve narrowed it down to the following The terminal shell path "dotnet" is a directory. Changing the build task to have a direct path to the dotnet executable works.

Before (Error)

{
    "label": "build",
    "command": "dotnet",
    "type": "process",
    "args": [
    "build",
    "${workspaceFolder}/ProcessedSaleWatcherService.csproj",
    "/property:GenerateFullPaths=true",
    "/consoleloggerparameters:NoSummary"
    ],
    "problemMatcher": "$msCompile"
},

After (Works)

{
    "label": "build",
    "command": "/home/ethanpreker/.dotnet/dotnet",
    "type": "process",
    "args": [
    "build",
    "${workspaceFolder}/ProcessedSaleWatcherService.csproj",
    "/property:GenerateFullPaths=true",
    "/consoleloggerparameters:NoSummary"
    ],
    "problemMatcher": "$msCompile"
},

Steps to Reproduce

Install dotnet sdk 3.0 on linux using dotnet-install.sh script.

./dotnet-install.sh -Channel Current

Add path to .bashrc or .zshrc

export PATH=$PATH:/home/ethanpreker/.dotnet

Run build task in vscode (ctrl + shift + B)

Expected Behavior

The project will build correctly

Actual Behavior

> Executing task: dotnet build /home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary <

The terminal shell path "dotnet" is a directory

Terminal will be reused by tasks, press any key to close it.

Logs

OmniSharp log

Starting OmniSharp server at 10/15/2019, 9:22:25 AM Target: /home/ethanpreker/Repos/ProcessedSaleWatcherService

OmniSharp server started with Mono 6.0.0. Path: /home/ethanpreker/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/OmniSharp.exe PID: 6056

    Starting OmniSharp on manjaro 0.0 (x64)
    DotNetPath set to dotnet
    It looks like you have Mono 5.2.0 or greater installed but MSBuild could not be found.

Try installing MSBuild into Mono (e.g. ‘sudo apt-get install msbuild’) to enable better MSBuild support. info: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 1 MSBuild instance(s) 1: StandAlone 16.0 - “/home/ethanpreker/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/.msbuild/Current/Bin” info: OmniSharp.MSBuild.Discovery.MSBuildLocator MSBUILD_EXE_PATH environment variable set to ‘/home/ethanpreker/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/.msbuild/Current/Bin/MSBuild.dll’ info: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: StandAlone 16.0 - “/home/ethanpreker/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/.msbuild/Current/Bin” CscToolExe = csc.exe TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks MSBuildToolsPath = /home/ethanpreker/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/.msbuild/Current/Bin CscToolPath = /home/ethanpreker/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/.msbuild/Current/Bin/Roslyn BypassFrameworkInstallChecks = true MSBuildExtensionsPath = /usr/lib/mono/xbuild info: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService’. info: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files info: OmniSharp.MSBuild.ProjectSystem No solution files found in ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService’ info: OmniSharp.MSBuild.ProjectManager Queue project update for ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj’ info: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService’. 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.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200 info: OmniSharp.WorkspaceInitializer Configuration finished. info: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService’ on host 5630. info: OmniSharp.MSBuild.ProjectManager Loading project: /home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj’. info: OmniSharp.MSBuild.ProjectManager Adding project ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj’ info: OmniSharp.MSBuild.ProjectManager Update project: ProcessedSaleWatcherService info: OmniSharp.MSBuild.ProjectManager Queue project update for ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj’ info: OmniSharp.MSBuild.ProjectManager Queue project update for ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj’ info: OmniSharp.MSBuild.ProjectManager Queue project update for ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj’ info: OmniSharp.MSBuild.ProjectManager Queue project update for ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj’ info: OmniSharp.MSBuild.ProjectManager Loading project: /home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj warn: OmniSharp.MSBuild.ProjectLoader Package ‘System.Net.Http.Formatting.Extension 5.2.3’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8’ instead of the project target framework ‘.NETCoreApp,Version=v3.0’. This package may not be fully compatible with your project. info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file ‘/home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj’. /home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj /home/ethanpreker/Repos/ProcessedSaleWatcherService/ProcessedSaleWatcherService.csproj(0,0): Error: Package ‘System.Net.Http.Formatting.Extension 5.2.3’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8’ instead of the project target framework ‘.NETCoreApp,Version=v3.0’. This package may not be fully compatible with your project.

    Update project: ProcessedSaleWatcherService

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.38.1 C# Extension: 1.21.4

Mono Information OmniSharp using global mono :6.0.0
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26

Runtime Environment: OS Name: manjaro OS Version:
OS Platform: Linux RID: linux-x64 Base Path: /home/ethanpreker/.dotnet/sdk/3.0.100/

Host (useful for support): Version: 3.0.0 Commit: 7d57652f33

.NET Core SDKs installed: 2.2.108 [/home/ethanpreker/.dotnet/sdk] 3.0.100 [/home/ethanpreker/.dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.6 [/home/ethanpreker/.dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.6 [/home/ethanpreker/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.0 [/home/ethanpreker/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.6 [/home/ethanpreker/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.0 [/home/ethanpreker/.dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
Angular-BeastCode Mikael 8.0.10
Angular2 johnpapa 8.1.1
angular2-inline natewallace 0.0.17
angular2-switcher infinity1207 0.2.0
auto-close-tag formulahendry 0.5.6
autoimport steoates 1.5.3
azure-account ms-vscode 0.8.4
azure-pipelines ms-azure-devops 1.157.4
Bookmarks alefragnani 10.5.0
bracket-pair-colorizer CoenraadS 1.0.61
bracket-pair-colorizer-2 CoenraadS 0.0.28
code-d webfreak 0.20.2
code-gnu-global austin 0.2.2
code-settings-sync Shan 3.4.3
cpptools ms-vscode 0.25.1
csharp ms-vscode 1.21.4
csharp2ts rafaelsalguero 0.0.22
csharpextensions jchannon 1.3.0
dark-plus-material vangware 2.1.0
debug webfreak 0.23.1
debugger-for-chrome msjsdiag 4.12.0
deepdark-material Nimda 3.2.0
dlang-bundle webfreak 0.4.0
dotenv mikestead 1.0.1
EditorConfig EditorConfig 0.13.0
electron kuscamara 0.2.5
gc-excelviewer GrapeCity 2.1.32
gitblame waderyan 3.0.1
gitlab-workflow fatihacet 2.1.1
gitlens eamodio 10.0.1
html-css-class-completion Zignd 1.19.0
html-snippets abusaidm 0.2.1
JavaScriptSnippets xabikos 1.7.2
Kotlin mathiasfrohlich 1.7.0
latex-workshop James-Yu 8.1.1
material-icon-theme PKief 3.9.0
material-palenight-theme whizkydee 1.9.6
mssql ms-mssql 1.6.0
npm-intellisense christian-kohler 1.3.0
nsis idleberg 3.19.0
path-intellisense christian-kohler 1.4.2
pdf tomoki1207 0.5.1
plastic will-stone 2.4.0
powershell ms-vscode 2019.9.0
prettier-vscode esbenp 2.2.2
printcode nobuhito 3.0.0
propertylist zhouronghui 0.0.2
python ms-python 2019.9.34911
quicktype quicktype 12.0.46
quokka-vscode WallabyJs 1.0.253
scala scala-lang 0.3.8
shell-launcher Tyriar 0.3.0
stardog-rdf-grammars stardog-union 0.1.2
theme-dracula dracula-theme 2.18.0
theme-material-theme jprestidge 1.0.1
theme-onedark azemoh 0.5.2
typescript-hero rbbit 3.0.0
vetur octref 0.22.3
vsc-material-theme Equinusocio 30.0.0
vscode-azureappservice ms-azuretools 0.15.0
vscode-csharp-snippets jorgeserrano 0.3.1
vscode-docker ms-azuretools 0.8.1
vscode-eslint dbaeumer 1.9.1
vscode-exec-node miramac 0.5.1
vscode-firefox-debug firefox-devtools 2.3.1
vscode-html-css ecmel 0.2.3
vscode-icons vscode-icons-team 9.4.0
vscode-import-cost wix 2.12.0
vscode-npm-script eg2 0.3.9
vscode-scss mrmlnc 0.6.2
vscode-simple-icons LaurentTreguier 1.11.10
vscode-test-explorer hbenl 2.14.6
vscode-theme-onedark akamud 2.1.0
vscode-typescript-tslint-plugin ms-vscode 1.2.2
vscode-versionlens pflannery 0.24.0
vscode-wakatime WakaTime 2.2.0
vsliveshare ms-vsliveshare 1.0.869
vue-snippets hollowtree 0.1.11
Vue2 ducksoupdev 0.1.3
xml DotJoshJohnson 2.5.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
auspexcommented, Oct 22, 2019

The true error is that the tasks.json file is being built with "type": "process" rather than "type": "shell" https://github.com/microsoft/vscode/issues/79346 gets this wrong, too, but I can’t comment on that. Thanks to https://stackoverflow.com/a/58486984/334719

2reactions
auspexcommented, Oct 21, 2019

I agree, this is not fixed and should not be closed! Every time I create a project, I have to go in and hardcode the path to the dotnet executable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code and dotnet core: fixing 'The terminal shell path ...
The terminal process failed to launch: Path to shell executable "dotnet" is not a file or a symlink. The dotnet executable was well...
Read more >
Visual Studio Code build task give 'The terminal shell path ...
I've installed dotnet sdk in my Linux and setup the DOTNET_ROOT and PATH to the $HOME/dotnet. When I run dotnet command on bash...
Read more >
The terminal shell path "dotnet" is a directory - Visual Studio ...
I have been using Visual Studio Code in Ubuntu Linux for a while, but it was not an easy process to get it...
Read more >
the terminal shell path cmd.exe does not exist vscode
With process if PATH contains a directory that has a sub directory named dotnet then the process code will try to execute that...
Read more >
Terminal Shell Integration in Visual Studio Code
This additional information enables some useful features such as working directory detection and command detection, decorations, and navigation. Supported ...
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