Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The terminal shell path "dotnet" is a directory #3350

Closed
abaga129 opened this issue Oct 15, 2019 · 8 comments
Closed

The terminal shell path "dotnet" is a directory #3350

abaga129 opened this issue Oct 15, 2019 · 8 comments

Comments

@abaga129
Copy link

abaga129 commented Oct 15, 2019

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)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[warn]: OmniSharp.MSBuild.Discovery.Providers.MonoInstanceProvider
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
@JoeRobich
Copy link
Member

Hi @abaga129,
Sorry you ran into this. It seems you were able to fix this by making sure dotnet was on your path, which is what we expect.
-Joey

@abaga129
Copy link
Author

abaga129 commented Oct 15, 2019

It's not exactly fixed. I have to change my tasks to have a hardcoded path to the dotnet binary e.g. "command": "/home/ethanpreker/.dotnet/dotnet". This would be okay except that when someone else pulls my code and tries to run it, they wont have dotnet at the same path. Is there some way I make it work with "command": "dotnet",?

Thanks for your time

@auspex
Copy link

auspex commented 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.

@auspex
Copy link

auspex commented Oct 21, 2019

Further, if I use F5 to build the project, I get this error message, but if I open a terminal and use
dotnet build it works fine.

@auspex
Copy link

auspex commented Oct 22, 2019

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

@abaga129
Copy link
Author

Thanks @auspex! That did the trick for me as well! I guess now this issue can be closed sarcasm

@rishitc
Copy link

rishitc commented Jun 19, 2020

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

Just wanted to mention that in my case changing process to shell actually made it work error-free. I didn't have to change anything else in the tasks.json file.

@tobil4sk
Copy link

tobil4sk commented Oct 3, 2022

Just to update, this issue was fixed properly in microsoft/vscode#158666 and the fix should be available in the next vscode release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants