The current GitHub Codespaces environment only has the .NET 8 SDK installed, which does not support .NET 9.0. To enable .NET 9 support, you need to install the .NET 9 SDK.

We can run below command to add the support of .NET 9 SDK.

wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh -O dotnet-install.sh && bash dotnet-install.sh --version 9.0.100 && export DOTNET_ROOT=$HOME/.dotnet && export PATH=$PATH:$HOME/.dotnet

Then run the below command to list the .NET SDKs.

~/.dotnet/dotnet --list-sdks

That’s how you can install .NET 9 in GitHub Codespaces.