Last active
December 15, 2023 15:40
Sample build & test GitHub Action file for .NET Framework (MSBuild)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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