@ -10,8 +10,8 @@ This action sets up a [.NET CLI](https://github.com/dotnet/sdk) environment for
> **Note**: GitHub hosted runners have some versions of the .NET SDK
> **Note**: GitHub hosted runners have some versions of the .NET SDK
preinstalled. Installed versions are subject to change. Please refer to the
preinstalled. Installed versions are subject to change. Please refer to the
documentation
documentation:
[software installed on github hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software)
[Software installed on github hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software)
for .NET SDK versions that are currently available.
for .NET SDK versions that are currently available.
## Usage
## Usage
@ -27,6 +27,7 @@ steps:
dotnet-version: '3.1.x'
dotnet-version: '3.1.x'
- run: dotnet build <myproject>
- run: dotnet build <myproject>
```
```
> **Warning**: Unless a concrete version is specified in the [`global.json`](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json) file, **_the latest .NET version installed on the runner (including preinstalled versions) will be used [by default](https://learn.microsoft.com/en-us/dotnet/core/versions/selection#the-sdk-uses-the-latest-installed-version)_**. Please refer to the [documentation](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software) for the currently preinstalled .NET SDK versions.
**Multiple version installation**:
**Multiple version installation**:
```yml
```yml
@ -40,8 +41,6 @@ steps:
5.0.x
5.0.x
- run: dotnet build <myproject>
- run: dotnet build <myproject>
```
```
> **Note**: In case multiple versions are installed, the latest .NET version will be used by default unless another version is specified in the `global.json` file.
## Supported version syntax
## Supported version syntax
The `dotnet-version` input supports following syntax:
The `dotnet-version` input supports following syntax:
@ -97,7 +96,31 @@ jobs:
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v3
with:
with:
dotnet-version: ${{ matrix.dotnet }}
dotnet-version: ${{ matrix.dotnet }}
- run: dotnet build <myproject>
- name: Execute dotnet
run: dotnet build <myproject>
```
>**Note**: Unless a concrete version is specified in the [`global.json`](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json) file, the latest .NET version installed on the runner (including preinstalled versions) will be used [by default](https://learn.microsoft.com/en-us/dotnet/core/versions/selection#the-sdk-uses-the-latest-installed-version). To control this behavior you may want to use temporary `global.json` files:
**Matrix testing with temporary global.json creation**