Skip to content

Instantly share code, notes, and snippets.

@thepwrtank18
Created December 19, 2021 03:41
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 thepwrtank18/e2b91617124d45bf4876d52dce7319a3 to your computer and use it in GitHub Desktop.
Save thepwrtank18/e2b91617124d45bf4876d52dce7319a3 to your computer and use it in GitHub Desktop.
Using GitHub Actions for .NET Framework Desktop Apps to create artifacts

Here is the Actions code:

name: Build App
 
on: [push]
 
jobs:
  build:
 
    runs-on: windows-latest
 
    steps:
    - uses: actions/checkout@v1
      name: Checkout Code
     
    - name: Setup MSBuild Path
      uses: warrenbuckley/Setup-MSBuild@v1
      env:
         ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
       
    - name: Setup NuGet
      uses: NuGet/setup-nuget@v1.0.2
      env:
         ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
     
    - name: Restore NuGet Packages
      run: nuget restore {{REPLACEWITHSOLUTIONNAME}}}.sln
 
    - name: Build and Publish App
      run: msbuild {{REPLACEWITHSOLUTIONNAME}}}.sln /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
 
    - name: Upload Artifact
      uses: actions/upload-artifact@v2.3.1
      env:
         ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
      with:
        name: SkyrimSELauncher_fake
        path: \bin\Release

Note that the first time, this will fail.
However, in the logs, it shows the actual directory of the project's build (for example, D:\a\{{REPLACEWITHSOLUTIONNAME}}\{{REPLACEWITHSOLUTIONNAME}}\{{REPLACEWITHSOLUTIONNAME}}\bin\Release). Replace \Bin\Release at the end of the project with that, then run it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment