How to update `dotnet` skd and runtime when installed on GitHub Codespaces
- 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:

### 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.

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.

### 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
Assessment
This issue has not been assessed yet.