Add GitHub Actions workflow for .NET Core Desktop#2384
Open
jarlungoodoo73 wants to merge 1 commit into
Open
Conversation
This workflow builds, tests, signs, and packages a .NET Core desktop application, specifically for WPF or Windows Forms. It includes steps for setting up the environment, restoring the application, and handling signing certificates.
There was a problem hiding this comment.
Pull request overview
Adds a new GitHub Actions workflow intended to build, test, sign, and package a .NET “desktop” application on Windows runners.
Changes:
- Introduces
.github/workflows/dotnet-desktop.ymlwith a Windows build job and Debug/Release matrix. - Adds signing certificate decode + MSIX packaging steps and uploads build artifacts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+58
to
+62
| env: | ||
| Solution_Name: your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln. | ||
| Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. | ||
| Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. | ||
| Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. |
Comment on lines
+71
to
+74
| - name: Install .NET Core | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: 8.0.x |
Comment on lines
+80
to
+83
| # Execute all unit tests in the solution | ||
| - name: Execute unit tests | ||
| run: dotnet test | ||
|
|
Comment on lines
+90
to
+96
| # Decode the base 64 encoded pfx and save the Signing_Certificate | ||
| - name: Decode the pfx | ||
| run: | | ||
| $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") | ||
| $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx | ||
| [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | ||
|
|
Comment on lines
+97
to
+104
| # Create the app package by building and packaging the Windows Application Packaging project | ||
| - name: Create the app package | ||
| run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} | ||
| env: | ||
| Appx_Bundle: Always | ||
| Appx_Bundle_Platforms: x86|x64 | ||
| Appx_Package_Build_Mode: StoreUpload | ||
| Configuration: ${{ matrix.configuration }} |
Comment on lines
+106
to
+108
| # Remove the pfx | ||
| - name: Remove the pfx | ||
| run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This workflow builds, tests, signs, and packages a .NET Core desktop application, specifically for WPF or Windows Forms. It includes steps for setting up the environment, restoring the application, and handling signing certificates.