1

.NET 9 runtime isn't available (yet) for AWS Codebuild. Even after installing the SDK using the following commands, my build would still get .NET 6 instead:

version: 0.2
env:
  shell: bash
phases:
  install:
    commands:
      - curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh
      - chmod +x ./dotnet-install.sh
      - ./dotnet-install.sh --channel 9.0 --install-dir /root/.dotnet/
      - dotnet --version
      - dotnet --info

1 Answer 1

1

I found out that an extra command must be executed so dotnet's global.json gets updated properly with the latest SDK version:

dotnet new globaljson --sdk-version 9.0.308 --roll-forward latestFeature

Also the dotnet sdk must be installed in this folder:

/root/.dotnet/

My final code looks like this now:

version: 0.2
env:
  shell: bash
phases:
  install:
    commands:
      - curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh
      - chmod +x ./dotnet-install.sh
      - ./dotnet-install.sh --channel 9.0 --install-dir /root/.dotnet/
      - dotnet new globaljson --sdk-version 9.0.308 --roll-forward latestFeature
      - dotnet --version
      - dotnet --info
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.