Skip to content

Instantly share code, notes, and snippets.

@guibranco
Last active December 15, 2023 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guibranco/9c14eb8d78758cf42d1d6e4d9230d000 to your computer and use it in GitHub Desktop.
Save guibranco/9c14eb8d78758cf42d1d6e4d9230d000 to your computer and use it in GitHub Desktop.
Sample build & test GitHub Action file for .NET Framework (MSBuild)
name: Build
on:
push:
branches:
- '*'
- '*/*'
- '**'
- '!main'
paths-ignore:
- "**/Properties/AssemblyInfo.cs"
- "**/Properties/Version.txt"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set solution name
run: |
echo "solution=$(([io.fileinfo]$(Get-ChildItem -Path .\* -Include *.sln)).name)" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.3
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Setup Nuget
uses: nuget/setup-nuget@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Restore NuGet packages
run: nuget restore ${{ env.solution }}
- name: Build Debug
run: msbuild ${{ env.solution }} /p:Configuration=Debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment