microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
197 stars 6 forks source link

[BUG] C# Dev Kit commands not found #225

Open ccalvarez opened 10 months ago

ccalvarez commented 10 months ago

Describe the Issue

I have installed the C# Dev Kit for VS Code extension.

When I open a folder containing a Visual Studio Solution, the expected Solution Explorer is not showing up.

Besides, when I try to run any command from the Command Palette, I got errors saying the command is not found:

image

Steps To Reproduce

  1. In this environment: Operating System: Windows 10 Version: 22H2 Compilation SO: 19045.2965

  2. Run Visual Studio Code image

  3. With C# Dev Kit extension installed, press CTRL-SHIFT-P to open the Command Palette

4, Find/choose: .NET: New Project... image

Expected Behavior

The expected behavior is to execute the command selected, instead of showing "command not found".

Environment Information

  1. OS: Windows 10 Version: 22H2 Compilation SO: 19045.2965

  2. VS Code: image

  3. Extension version: image

claudiaregio commented 10 months ago

I'm also running into this issue

webreidi commented 10 months ago

@ccalvarez Can you look at the C# extension? In order for C# Dev Kit to work, it requires the prerelease version (>2.0). You can get that version by clicking the "Switch to prerelease" button at the top of the C# extension page.

Please let me know if that fixes this issue and if you are able to create a new project after that.

ccalvarez commented 10 months ago

@webreidi thank you! I have switched to the prerelase version of the C# Extension, and now the C# Dev Kit works as expected.

Thanks!

image

and

image

JotaRata commented 10 months ago

The issue came back with the latest update

jhgorse commented 6 months ago

I see this on macOS for both available releases.

webreidi commented 6 months ago

@jhgorse Can you give a bit more details about what you were trying to do and which versions of C# Dev Kit and the C# extension you are using, please?

exhuma commented 6 months ago

I'm running into the same issue. Here are the versions that I have installed.

nb: I'm using these inside a dev-container based on the image mcr.microsoft.com/devcontainers/dotnet:7.0

Name: C#
Id: ms-dotnettools.csharp
Description: Base language support for C#
Version: 2.10.28
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp
Name: C# Dev Kit
Id: ms-dotnettools.csdevkit
Description: Official C# extension from Microsoft
Version: 1.0.14
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit
yonog1 commented 6 months ago

ive been getting the same error message "csdevkit not found" in the new version of vscode and vscode insiders unless i revert the c# extension to version 2.1.2. i tried installing vscode again thinking maybe some of its files are corrupt but that didnt fix anything. the only weird thing is i ran the vscode 1.80.0 installer and everything seemed to work fine, but then when vscode requested an update and i reloaded it went back to the current faulty state

jhgorse commented 6 months ago

@jhgorse Can you give a bit more details about what you were trying to do and which versions of C# Dev Kit and the C# extension you are using, please?

Same as OP. Command Palette: .NET: New Project... I have Mono 6.12. dotnet --list-sdks 6.0.410 [/usr/local/share/dotnet/sdk] 6.0.416 [/usr/local/share/dotnet/sdk] 7.0.304 [/usr/local/share/dotnet/sdk] 7.0.310 [/usr/local/share/dotnet/sdk] 7.0.403 [/usr/local/share/dotnet/sdk]

C# Dev Kit v1.0.14 and v1.1.12

C# Extension v2.10.28

It appears to have resolved itself. When creating a new project it no longer asks me to select a Dev Kit. Rather the templates list pops up instead.

I tried uninstalling and re-installing the plugins. No reproduction. I think I'd need a clean vscode, which I am not sure how best to accomplish without negatively affecting my projects in progress.

Cheers, Joe

mike-reilly-bg commented 6 months ago

Hello, I have just run into this myself, and I am currently not able to resolve it.

Steps to reproduce:

  1. Open VS Code
  2. Ctrl + shift + p to open command pallet, ".NET: New Project..."
  3. Error popup: "command 'csdevkit.addNewProject' not found"

I have tried all the permutations of the current and prerelease versions for the MS C# and C# Dev Kit extensions, with the necessary window reloads:

image

EDIT:

My OS is Windows 10:

image

image

mike-reilly-bg commented 6 months ago

RESOLVED (not a bug)

For future readers, the issue was a necessary extension setting, which was warned in a popup that I blew by =/

To fix:

  1. ctrl + shift + p, "Preferences: Open User Settings (JSON)
  2. Add this setting to the file, before the final '}': "dotnet.preferCSharpExtension": false

image

aspirio187 commented 5 months ago

I tried @mike-reilly-bg's solution and @ccalvarez's one.

Adding the line in the settings,json file doesn't seem to have any effect.

Neither does passing the C# and C# Dev Kit to preview. By the way, C# extensions doesn't have a preview version on my side. Is it possible that since the message was posted, there has been an update?

The only solution I have for the moment, instead of creating everything by hand, is to user C# Extensions extension.

For some context, I am using C# in WSL Ubuntu 22.04 and I install dotnet and all the tools using apt get install -y dotnet-6.0 dotnet-runtime-6.0 dotnet-templates-6.0 aspnetcore-runtime-6.0

jimwheeler commented 5 months ago

Also having this issue. Adding line in settings.json did not help. Pretty disappointed that we're told to switch to this since Visual Studio for Mac is going end of life and then it just breaks. I hope there is going to be better and more robust quality control very soon because I no one can afford to have their tools just suddenly stop working. I am on M1 Mac. Latest VS Code. Tried both CSDevKit 1.0.14 and the Pre-Release version.

timheuer commented 5 months ago

@aspirio187 and @jimwheeler are you still experiencing this?

jmoralesv commented 5 months ago

I'm suffering the same issue with my Surface Pro 8, Windows 11, .NET 8 SDK and the latest versions of both C# and C# Dev Kit extensions. Opening a C# project doesn't trigger IntelliSense, I can't run or debug the project. This doesn't happen in my laptop.

Uninstalling and installing the extensions again doesn't help at all. I guess it has something to do with either the settings or my configuration.

The previous workarounds didn't work either.

Is this a way to force us to install the massive Visual Studio 2022? It's a terrible experience for newcomers, I understand now the ratings in the marketplace for these extensions.

aspirio187 commented 5 months ago

@aspirio187 and @jimwheeler are you still experiencing this?

I cannot confirm 100% since I didn't reuse it on the laptop having this issue. On the other laptops, with the same configuration, no issue.

jmoralesv commented 5 months ago

Just wanted to add an update: the issues with the C# and C# Dev Kit extensions are gone after:

The second step is the one it resolved my issues, I think. Even after restarting VS Code the extensions folders were already there. I guess reinstalling the extensions was not fixing the issues because the folders already existed.

Anyway, now I can use IntelliSense, run and debug my .NET projects in my Surface Pro device.

Kaoticz commented 4 months ago

I'm writing to confirm that I have also encountered this bug and none of the solutions mentioned here worked for me, not even removing the extensions' folders.

poisson-fish commented 4 months ago

I can confirm this issue on both release and pre-release....

webreidi commented 4 months ago

@Kaoticz and @poisson-fish can you please look at the C# extension settings and make sure that you do not have Dotnet: Prefer C# Extension checked?

Also, can you provide which version of C# Dev Kit and C# extension you are using?

Kaoticz commented 4 months ago

@Kaoticz and @poisson-fish can you please look at the C# extension settings and make sure that you do not have Dotnet: Prefer C# Extension checked?

Also, can you provide which version of C# Dev Kit and C# extension you are using?

Here are the extensions I have: C# Dev Kit - v1.3.2 C# - v2.15.30 Intellicode for C# Dev Kit - v0.1.26 .NET Install Tool - v2.0.0

Prefer C# Extension is also unchecked. image

Possibly a relevant detail, but I'm using NixOS. Everything is installed in /nix/store, which is read-only. Do the C# extensions require write permissions in their folders in order to work? On a side-note, I haven't had issues with the C/C++ and Python extensions (also from Microsoft), they worked flawlessly without tinkering. The C# extensions not working caught me by surprise.

shackcrack007 commented 4 months ago

same issue for me, completely new win 10 completely updated, with new vscode and the extensions by the book

Michael-Eng commented 4 months ago

@Kaoticz and @poisson-fish can you please look at the C# extension settings and make sure that you do not have Dotnet: Prefer C# Extension checked? Also, can you provide which version of C# Dev Kit and C# extension you are using?

Here are the extensions I have: C# Dev Kit - v1.3.2 C# - v2.15.30 Intellicode for C# Dev Kit - v0.1.26 .NET Install Tool - v2.0.0

Prefer C# Extension is also unchecked. image

Possibly a relevant detail, but I'm using NixOS. Everything is installed in /nix/store, which is read-only. Do the C# extensions require write permissions in their folders in order to work? On a side-note, I haven't had issues with the C/C++ and Python extensions (also from Microsoft), they worked flawlessly without tinkering. The C# extensions not working caught me by surprise.

Yes we do require write permissions to copy files and build up some internal MEF components.

Beldarak commented 4 months ago

Same issue here since the last version (2.15.30) with my Unity project.

I've reverted to 2.14.18 and eveything's working fine on this version.

I'm using .Net install Tool (v2.0.0), C# Dev Kit (v1.3.2 pre-release), IntelliCode for C# Dev Kit (v0.1.26 preview), Unity (Unity for Visual Studio Code) (v0.9.4 preview)

Hope that helps :)

Kaoticz commented 4 months ago

Yes we do require write permissions to copy files and build up some internal MEF components.

Oh, it could be it then. I guess it can't be helped. Thanks for the support.

webreidi commented 1 month ago

@jbevain did you see the comment on Jan 18 about it working in 2.14.18, but not in 2.15.30 of Unity, and reverting the Unity version made it work. Is this a known issue with Unity?

It seems the original issue with NixOS is something we can't resolve due to no access to write to the necessary directory. If there is nothing else on the Unity issue we can close this ticket.

akaloshych84 commented 1 month ago

Same problem, macOS, VSCode connected to linux VM via remote SSH.

jbevain commented 1 month ago

@arkalyanms @webreidi there's nothing in here specific to Unity. They're talking about reverting the C# extension version. 2.15.30 is not a Unity version.

smitpatel commented 3 weeks ago

Moved the area. The issue occurs when C# dev kit fails to activate fully. Possible causes include C# extension not present or older version or preferring C# extension via settings. Readonly OS. We should summarize set of requirements for C# dev kit activation.

webreidi commented 3 weeks ago

@Beldarak can you verify that you do not have dotnet.preferCSharpExtension set to true for the workspace?

arkalyanms commented 3 weeks ago

@smitpatel could we add a check to that effect before activation and throw up an error and/or disable if prereq was not met?

smitpatel commented 3 weeks ago

Looking at code, we do log messages when prereq is not met. We also show prompt for upgrade if C# extension is old.

Looking at commands in command palette, we should hide some of the commands which doesn't make sense to show in empty workspace like rebuild solution. We should only show them once solution is open. Certain commands like add new project are supposed to activate the extension. If possible we should show error message if user selected command which activated extension but it failed. (contrast to case where extension activate because of csproj file where user may not want to use the extension).

Tagging @AArnott if he has more insights on how we can improve experience here.