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

Dotnet (.Net) with VSCode Locally doesn't work with default tasks.json #10831

Closed
joeizy opened this issue Jun 22, 2022 · 7 comments
Closed

Dotnet (.Net) with VSCode Locally doesn't work with default tasks.json #10831

joeizy opened this issue Jun 22, 2022 · 7 comments

Comments

@joeizy
Copy link

joeizy commented Jun 22, 2022

Bug description

When I use VSCode locally, the auto-generated Run & Debug doesn't work. I get the error: The terminal process failed to launch: Path to shell executable "dotnet" is not a file or a symlink.

image

image

This happens even when using the https://github.com/gitpod-io/template-dotnet-core-cli-csharp template.

Steps to reproduce

  1. Navigate to template dotnet project https://github.com/gitpod-io/template-dotnet-core-cli-csharp
  2. Open in GitPod
  3. Open that workspace VSCode locally
  4. Install the C# extension in VSCode
  5. Click Yes to add the required assess for build & debug.
    image
  6. Click the "Run & Debug" button

image

Notice that this works fine the browser.

Workspace affected

No response

Expected behavior

The console app should run and debugger should attach in VSCode Local in the same way that it does when running VSCode in Browser.

NOTE: When you click "Run & Debug" button in VSCode (browser or local) it generates two files .vscode/launch.json and .vscode/tasks.json. The files which are generated by VSCode browser and VSCode local are identical.

Example repository

The issue is reproducible with the GitPod Dotnet Sample or any blank dotnet project such as one created with dotnet new <template_name> such as dotnet new console.

Here are two workarounds I was able to find but neither is ideal because you should be able to run dotnet new, open in vscode desktop, and immediately hit debug/run.

  1. change build tasks to 'shell' from 'process' in branch working-task-as-shell

image

  1. change build task command - full path to dotnet in branch working-command-full-path

image

These workarounds do not break vscode in browser.

Anything else?

No response

@joeizy joeizy added the type: bug Something isn't working label Jun 22, 2022
@0xakihiko
Copy link

0xakihiko commented Aug 2, 2022

I'm also experiencing this, can confirm changing command path works.

@akosyakov akosyakov added feature: vscode-extension Having to do with VS Code extensions. team: IDE language: dotnet labels Aug 4, 2022
@akosyakov
Copy link
Member

akosyakov commented Aug 4, 2022

@kylos101 @aledbf @ghuntley Is it the same like #10122

I'm trying to reproduce and getting as well:
"The terminal process failed to launch: Path to shell executable "dotnet" is not a file or a symlink."

I don't think there is something to change in IDE, it is rather template shoudl be changed or something wrong with dotnet setup in workspace images. cc @gitpod-io/engineering-workspace @gitpod-io/dcs

@tobil4sk
Copy link

tobil4sk commented Aug 18, 2022

I just came across this when searching for an issue I was experiencing with an unrelated project. In case this is any help, this is the issue that is causing the error: microsoft/vscode#106661. Unfortunately, it doesn't seem like it'll get fixed.

You probably have a dotnet folder in your home directory (which might be the PWD of vscode). When the task is run as a process, for some reason this folder gets in the way and this error is shown before it is even able to look for a dotnet executable in PATH.

UPDATE: I ended up making a PR myself to fix this issue in VSCode: microsoft/vscode#158666

@tobil4sk
Copy link

Just to update, microsoft/vscode#158666 has been merged. With the next vscode release this issue should be resolved.

@axonasif
Copy link
Member

cc @jeanp413 @akosyakov

@akosyakov
Copy link
Member

@tobil4sk It should be in VS Code insider on our side already. Select latest in https://gitpod.io/preferences and try.

@jeanp413
Copy link
Member

Closing this as @tobil4sk PR got merged upstream, you can test it by installing vscode-desktop insiders

@jeanp413 jeanp413 added editor: code (desktop) and removed feature: vscode-extension Having to do with VS Code extensions. labels Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

6 participants