Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

setup-dotnet

v1.4.0

setup-dotnet

play

setup-dotnet

A wrapper around the official actions/setup-dotnet action with extra features

Installation

Copy and paste the following snippet into your .yml file.

              

- name: setup-dotnet

uses: xt0rted/setup-dotnet@v1.4.0

Learn more about this action in xt0rted/setup-dotnet

Choose a version

setup-dotnet

A wrapper around the official actions/setup-dotnet action with extra features that aren't yet implemented.

  1. Sets DOTNET_INSTALL_DIR based on the OS so existing sdks are used when available (actions/setup-dotnet#284, actions/setup-dotnet#208)
  2. Strips comments from the global.json before calling actions/setup-dotnet and then restores them (actions/setup-dotnet#257)
  3. Sets DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION and TERM to force color output by default (actions/setup-dotnet#288).

Usage

Basic usage with SDK version from the global.json.

- name: Set up .NET
  uses: xt0rted/setup-dotnet@v1.0.0

Specifying a single SDK version to use.

- name: Set up .NET
  uses: xt0rted/setup-dotnet@v1.0.0
  with
    dotnet-version: 6.0.201

Specifying multiple SDK versions to use.

- name: Set up .NET
  uses: xt0rted/setup-dotnet@v1.0.0
  with
    dotnet-version: |
      3.1.417
      5.0.406
      6.0.201

Specifying a custom source and auth token.

- name: Set up .NET
  uses: xt0rted/setup-dotnet@v1.0.0
  with:
    source-url: https://nuget.pkg.github.com/xt0rted/index.json
    nuget_auth_token: ${{ secrets.GITHUB_TOKEN }}

Options

Name Default value Description
colored-output true Sets the required environment variables to force color output from dotnet.
nuget_auth_token "" Optional authentication token used with source-url.
strip-comments-from-global-json true Whether to strip comments from the global.json file.

ℹ️ This action requires passing nuget_auth_token as an input not an environment variable.

All inputs supported by actions/setup-dotnet are supported and passed through to it. The full list of supported inputs can be seen in the action.yml file.

Known issues

  1. The step to strip comments from the global.json file uses npx and requires Node.js 16 or newer to work. If you're using an older version of node and don't need this step to run you can disable it with the strip-comments-from-global-json setting.