dotnet / dotnet/core

How to update `dotnet` skd and runtime when installed on GitHub Codespaces

Open
#8,948 5 comments 4 reactions 0 assignees View on GitHub
area-setup
Dominant language
PowerShell
Stars
22k
Forks
4.9k
Avg merge
5d 5h
Merged PRs (30d)
29

Description

### Description
I have a project whos `global.json` provides the following sdk version:

```json
{
"sdk": {
"version": "7.0.404"
}
}
```

When I used the GitHub Codespaces universal image (which does contain a preinstalled version of `dotnet` sdk., I get version 7.0.306. So of course when I attempt to use the `dotnet` cli or any other extension or attempt to build I get failures saying:

![image](https://github.com/dotnet/core/assets/3408176/e630db88-ce14-4d93-bbfd-7c4a881469a1)

### How, or what is the right way to update the sdk version.

1. I first went to [this tutorial](https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#register-the-microsoft-package-repository) to attempt to update with `sudo apt-get update && sudo apt-get upgrade` etc, however still the only version that was showing up as detected was the original version the codespace installs.

2. I then attempted to use the [dotnet-install.sh script](https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install) and as you can see from the image I provided, it was installed, however when I run `dotnet` again, it still only detects the original version.

![image](https://github.com/dotnet/core/assets/3408176/8650db83-3104-4af5-8ae4-3b77d0c9a3f3)

 3. I then attempted to use a [different devcontainer image](https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/setting-up-your-dotnet-project-for-codespaces) (thinking that this would contain the most recent patch version of the 7.0 channel). I used the following image setting:
 
```devcontainer.json
{
"image":"mcr.microsoft.com/devcontainers/dotnet:0-7.0"
}
```

4. Then I rebuilt the dev container and instead got version 7.0.401. So I repeated steps 1-3 again just to make sure, and still was receiving 7.0.401 as the detected version:

Here is the terminal results from the dotnet-install script which says that 7.0.404 is installed but `dotnet --info` command only detecting 7.0.401.

![image](https://github.com/dotnet/core/assets/3408176/cc9be92f-3f87-4c2b-bdb5-2420bb77457e)

### Steps to reproduce
1. Open any .dotnet project [for example this one](https://github.com/johan-lindqvist/gothmog-bot) with the GitHub Universal Codespaces image 
2. Attempt to use `apt-get` or `dotnet-install.sh` script to update dotnet version
3. Observe it not detecting the correctly updated sdk. 

I'm happy to reopen this in a different repo if helpful, and contribute documentation somewhere so that any first time dotnet users as myself don't have to waste multiple hours of troubleshooting to figure this headscratcher out. 😛

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.