一键导入
dotnet-maui-cicd
GitHub Actions CI/CD patterns for .NET MAUI Windows applications with MSIX packaging
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
GitHub Actions CI/CD patterns for .NET MAUI Windows applications with MSIX packaging
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Setting up comprehensive test infrastructure for .NET projects with xUnit, Moq, and EF Core InMemory
Strategies for testing applications with expensive or complex external dependencies (APIs, ML models, media processing tools)
{what this skill teaches agents}
| name | dotnet-maui-cicd |
| description | GitHub Actions CI/CD patterns for .NET MAUI Windows applications with MSIX packaging |
| domain | ci-cd, deployment, windows-store |
| confidence | low |
| source | earned |
When building CI/CD pipelines for .NET MAUI Windows applications destined for the Windows Store, you need to handle:
This skill captures patterns for GitHub Actions workflows that handle these requirements efficiently.
PR Validation - Fast feedback loop
Continuous Integration - Extended validation
Release - Production packaging
For preview .NET versions (like .NET 10), use:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
dotnet-quality: 'preview' # Critical for preview versions
MSIX packaging requires MAUI workloads:
- name: Install MAUI Workloads
run: dotnet workload install maui
Only needed in release workflow, not PR validation (speeds up PR builds).
Use MSBuild property to control packaging:
# PR/CI builds - fast, no packaging
- name: Build solution
run: dotnet build --configuration Release /p:WindowsPackageType=None
# Release builds - with MSIX
- name: Build MSIX Package
run: dotnet publish -c Release -f net10.0-windows10.0.19041.0 /p:WindowsPackageType=MSIX
Store certificate as Base64, decode at runtime, clean up after:
- name: Decode signing certificate
if: ${{ secrets.WINDOWS_CERTIFICATE_BASE64 != '' }}
shell: pwsh
run: |
$certBytes = [Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE_BASE64 }}")
$certPath = Join-Path $env:RUNNER_TEMP "certificate.pfx"
[IO.File]::WriteAllBytes($certPath, $certBytes)
echo "CERTIFICATE_PATH=$certPath" >> $env:GITHUB_ENV
- name: Build with signing
run: |
dotnet publish /p:PackageCertificateKeyFile="$env:CERTIFICATE_PATH" \
/p:PackageCertificatePassword="${{ secrets.CERTIFICATE_PASSWORD }}"
- name: Cleanup certificate
if: always() && env.CERTIFICATE_PATH != ''
shell: pwsh
run: |
if (Test-Path $env:CERTIFICATE_PATH) {
Remove-Item $env:CERTIFICATE_PATH -Force
}
Key points:
$env:RUNNER_TEMP (auto-cleaned by GitHub)Extract version from Git tags or workflow inputs:
- name: Determine Version
id: version
shell: pwsh
run: |
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
$version = "${{ github.event.inputs.version }}"
} elseif ("${{ github.ref }}" -like "refs/tags/v*") {
$version = "${{ github.ref }}".Replace("refs/tags/v", "")
} else {
$version = "1.0.0"
}
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
- name: Use version
run: dotnet publish /p:ApplicationVersion=${{ steps.version.outputs.VERSION }}.0
Use TRX format and upload for visualization:
- name: Run tests
run: dotnet test --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage"
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Results
path: '**/test-results.trx'
reporter: dotnet-trx
fail-on-error: true
Different retention for different artifact types:
# PR test results - short retention
- uses: actions/upload-artifact@v4
with:
retention-days: 7
# CI build outputs - medium retention
- uses: actions/upload-artifact@v4
with:
retention-days: 14
# Release packages - long retention
- uses: actions/upload-artifact@v4
with:
retention-days: 90
Skip CI for documentation changes:
on:
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- '.ai-team/**'
- 'LICENSE'
name: PR Validation
on:
pull_request:
branches: [ main ]
paths-ignore: ['**.md', 'docs/**']
jobs:
build-and-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
dotnet-quality: 'preview'
- run: dotnet restore
- run: dotnet build --configuration Release --no-restore /p:WindowsPackageType=None
- run: dotnet test --configuration Release --no-build --logger "trx"
- uses: dorny/test-reporter@v1
if: always()
with:
name: Test Results
path: '**/test-results.trx'
reporter: dotnet-trx
See .github/workflows/release.yml in VideoSplitter project for full example.
❌ Don't build MSIX on every PR
❌ Don't store certificates in repository
❌ Don't hardcode versions
❌ Don't skip tests in release builds
❌ Don't use same retention for all artifacts
❌ Don't forget to clean up sensitive files
if: always() for cleanup stepsdotnet-testing-setup - Setting up xUnit test infrastructuretesting-external-dependencies - Mocking for testable code