Wednesday, June 14, 2023

Setting up .NET SDK on Ubuntu with snap

 On Ubuntu, you can easily set up dotnet using snap. (https://learn.microsoft.com/en-us/dotnet/core/install/linux-snap).


sudo snap install dotnet-sdk --classic

sudo snap alias dotnet-sdk.dotnet dotnet




However,  when you open a newly created project with vscode, you may get the error of complaining the SDK not being found.




It looks like this is due to the dotnet executable not being found at a location vscode is expected.  To overcome this, you simple create a symbolic link of the dotnet executable at /usr/local/bin (ref: https://github.com/dotnet/vscode-csharp/issues/3077)

cd /usr/local/bin

sudo ln -sv /snap/dotnet-sdk/current/dotnet   .



After, vscode should work as expected.






No comments: