Automatically setup .NET environment for actively used SDK versions
The action is typically used in combination with which-dotnet to keep the CI environment up-to-date with evolving .NET versions used in your repository projects.
If no previously persisted JSON file is provided, automatic discovery of used .NET SDK versions will be performed using which-dotnet.
It's recommended you set up a separate workflow that keeps a
dotnet.json
file up-to-date to speed-up your builds by avoiding dynamic discovery on every build.
Assuming your repository has the dotnet.json
file in its default location (under ./.github
),
or has no versions file at all:
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
- name: 🙏 build
run: dotnet build
If you use a different location for the versions file:
- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
with:
versions: ./dotnet-versions.json
In order to bootstrap the initial dotnet.json
file, you can run the dotnet-env
tool with the -o
parameter, which initializes it at the default location ./.github/dotnet.json
.
dotnet-env is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.