Skip to content

.NET Build

This Composite Action builds a .NET package from the repository.

.NET Build

- uses: Yellow-Dog-Man/composite-actions-templates/.github/actions/dotnet-build@main

Builds a project with .NET.

Inputs: ยค

Name Description Default
dotnet-version

.NET version to use

10.0.x
dotnet-build-args

Additional args to pass to the .NET build process

dotnet-build-type

Type of build, pack or build.

build
dotnet-project-path

Path to the .NET project to build.

.
Source of Yellow-Dog-Man/composite-actions-templates/.github/actions/dotnet-build@main
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: '.NET Build'
description: 'Builds a project with .NET.'

inputs:
  dotnet-version:
    description: '.NET version to use'
    default: '10.0.x'
    required: false
  dotnet-build-args:
    description: 'Additional args to pass to the .NET build process'
    default: ''
    required: false
  dotnet-build-type:
    description: 'Type of build, pack or build.'
    default: 'build'
    required: false
  dotnet-project-path:
    description: 'Path to the .NET project to build.'
    default: '.'
    required: false

runs:
  using: composite

  steps:
    - name: 'Install .NET'
      uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
      with:
        dotnet-version: ${{ inputs.dotnet-version }}

    - name: 'Build Solution'
      shell: bash
      if: ${{ inputs.dotnet-build-type == 'build' }}
      run: dotnet build -c Release ${{ inputs.dotnet-build-args }} ${{ inputs.dotnet-project-path }}

    - name: 'Pack Solution for NuGET'
      shell: bash
      if: ${{ inputs.dotnet-build-type == 'pack' }}
      run: dotnet pack -c Release ${{ inputs.dotnet-build-args }} ${{ inputs.dotnet-project-path }}