Open melkio opened 3 years ago
We have similar issues with snap installs. You can try something like ln -s /snap/dotnet-sdk/current/dotnet /usr/local/bin/dotnet
but replace the snap dotnet folder with the asdf equivalent.
Hi @JoeRobich , same issue even applying your suggestion. It's a blocking issue since I can't use dotnet v5.x with omnisharp and vscode :(
Same issue here with the caveat that this is on WSL2. The C# extension can't find the .NET Core SDK. The issue is not resolved by any of the following:
sudo ln -s ~/.asdf/shims/dotnet /usr/local/bin/dotnet
or sudo ln -s ~/.asdf/install/dotent-core/5.0.402/dotnet /usr/local/bin/dotnet
~/.asdf/shims
or ~/.asdf/install/dotent-core/5.0.402/dotnet
to my Linux $PATH
\\wsl$\Ubuntu\home\<username>\.asdf\shims\dotnet
to my Windows %PATH%
code .
in my project's directorywhich dotnet
gives ~/.asdf/shims/dotnet
from both the integrated VSCode terminal and WSL2 Ubuntu.
The troubleshooting steps for Linux mention getUnixShellEnvironment, but I suspect that isn't the issue since the bug reproduces when VSCode is launched from the CLI, in which case that function shouldn't be called at all.
This worked for me: https://stackoverflow.com/questions/70820780/vscode-or-anothers-editors-dont-recognize-sdk-dotnet-installed-with-asdf/70820974#70820974
version=`asdf current dotnet-core | awk '{print $2}'`
echo "Parsed version: $version"
export DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR=$(echo $HOME/.asdf/installs/dotnet-core/$version/sdk/$version/Sdks)
export DOTNET_MSBUILD_SDK_RESOLVER_SDKS_VER=$version
export DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$(echo $HOME/.asdf/installs/dotnet-core/$version)
code .
https://gist.github.com/timabell/279823d5433176f24d170ef9c43d797e
(make sure there isn't already a copy of VSCode running otherwise I don't think it'll get the vars)
Thank you! I have been wondering about this for quite some time. I tried a slightly simplified version of the same thing, but it didn't work for me (c.f., https://github.com/OmniSharp/omnisharp-vscode/issues/2970#issuecomment-1073187929 for my pertinent OmniSharp log output). I feel like I am overlooking something obvious if anyone has any suggestions. On a side note, there is no reason to use echo
or command substitution in the export
statements in that StackOverflow answer; double quotes will suffice in this case. I added the following to the bottom of my .bashrc
.
export DOTNET_ROOT="$(asdf where dotnet-core)"
export DOTNET_MSBUILD_SDK_RESOLVER_SDKS_VER="$(basename $DOTNET_ROOT)"
export DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR="$DOTNET_ROOT/sdk/$DOTNET_MSBUILD_SDK_RESOLVER_SDKS_VER/Sdks"
export DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR="$DOTNET_ROOT"
Might be fixed by #4738
Environment data
dotnet --info
output:VS Code version:
1.56.2
C# Extension version:1.23.12
OmniSharp log
Steps to reproduce
Expected behavior
VsCode / Omnisharp should load project properly, without errors