0

I am not able to get intellisense for C# on vscode.

I used rtx-cli, which is basically like asdf, to install dotnet 7.0.306 on Ubuntu 22.04.2. I can run dotnet command on my terminal.

I enabled shims with rtx as well, so there is a $HOME/.local/share/rtx/shims in the path. which dotnet points to inside that directory.

In VSCode, I installed the recommended Microsoft C# extension. I also set the following 2 settings in my user level vscode config:

"dotnetAcquisitionExtension.existingDotnetPath": [
    "$HOME/.local/share/rtx/installs/dotnet/7.0.306/dotnet",
],
"dotnet.dotnetPath": "$HOME/.local/share/rtx/installs/dotnet/7.0.306",

Here is the output of dotnet --list-runtimes:

Microsoft.AspNetCore.App 7.0.9 [$HOME/.local/share/rtx/installs/dotnet/7.0.306/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.9 [$HOME/.local/share/rtx/installs/dotnet/7.0.306/shared/Microsoft.NETCore.App]

And here it is for dotnet --list-sdks:

7.0.306 [$HOME/.local/share/rtx/installs/dotnet/7.0.306/sdk]

I created the project with dotnet new console --framework net7.0 which gave me a folder with Program.cs, myapp.csproj, an obj directory. I also created a myapp.sln file with dotnet new sln.

When I open VSCode, I get the notification that .NET Core SDK cannot be located: A valid dotnet installation could not be found...

I am not able to get any auto complete or error squiggles in vscode when I edit the c# file.

NOTE: $HOME everywhere up above is a placeholder. I actually used the real absolute path.

Kushagra Gupta
  • 514
  • 2
  • 13
  • Might be cause by this issue/ behaviour of the C# extension for VS Code: [C# Intellisense in VS Code randomly stopped working today](https://stackoverflow.com/questions/76836174/c-sharp-intellisense-in-vs-code-randomly-stopped-working-today) – Mushroomator Aug 08 '23 at 18:28
  • @Mushroomator I tried both of the solutions given there and it didn't help. – Kushagra Gupta Aug 08 '23 at 18:42
  • is your issue the same as any of these? https://stackoverflow.com/search?q=%22.NET+Core+SDK+cannot+be+located%3A+A+valid+dotnet+installation+could+not+be+found%22 – starball Aug 09 '23 at 02:05
  • @starball I receive the same error message, yes. – Kushagra Gupta Aug 10 '23 at 04:51

0 Answers0