Thiago
Thiago

Reputation: 263

I can't set up my Linux Ubuntu 20.04 environment and VS Code properly to work with C#

I built a simple project to test if everything was working correctly. However, the autocomplete, IntelliCode, and other features are not working properly. When I try to load a project, I receive the message:

Activating the "Microsoft.VisualStudio.CpsProjectIconSourceService (0.1)" service failed.

I tried clearing the cache and configuration files, reinstalling the .NET SDK, opening and closing VS Code, resetting settings, reinstalling extensions, among other things.

Upvotes: 3

Views: 1135

Answers (2)

9 Guy
9 Guy

Reputation: 319

As per https://github.com/microsoft/vscode/issues/212296, this issue is OS agnostic. Downgrading to C# Dev Kit Extension version 1.5.20 worked for me, but later versions might work as well. This is on Windows 11.

Edit: 1.6.8 is the max I could get to work. 1.7.25 and above did not work.

Upvotes: 0

stefan.seeland
stefan.seeland

Reputation: 3279

There are known issues in latest .net + vscode + c# dev kit. The github issues hints to proof the setup of .net sdk.

There are multiple ways to setup .net 8 on ubuntu. Give this a try (known to compile .net 8 assemblies using ubuntu):

# drops old dependencies and repos
sudo snap remove dotnet-sdk
sudo apt remove 'dotnet*'
sudo apt remove 'aspnetcore*'
sudo apt remove 'netstandard*'
sudo apt autoremove -y
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo rm /etc/apt/sources.list.d/microsoft-prod.list.save

# Get Ubuntu version
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)

# Download Microsoft signing key and repository
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

# Install Microsoft signing key and repository
sudo dpkg -i packages-microsoft-prod.deb

# Clean up
rm packages-microsoft-prod.deb

# Update packages
sudo apt update 

# get .net 8
sudo apt-get install -y dotnet-sdk-8.0

Upvotes: 4

Related Questions