diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index da83641d65..fb5e5e8a9a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,11 +38,15 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - name: Update TargetFrameworks to net9.0 + shell: pwsh + run: | + .\.github\workflows\update-target-frameworks.ps1 -newTarget "net9.0" + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 10.0.x - dotnet-quality: preview + dotnet-version: 9.0.x - name: Initialize CodeQL uses: github/codeql-action/init@v3 @@ -52,7 +56,7 @@ jobs: - if: matrix.language == 'csharp' name: Manually build CSharp on .NET run: | - dotnet build Microsoft.FluentUI.sln + dotnet build Microsoft.FluentUI.sln -c Release - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/update-target-frameworks.ps1 b/.github/workflows/update-target-frameworks.ps1 new file mode 100644 index 0000000000..827c85eec1 --- /dev/null +++ b/.github/workflows/update-target-frameworks.ps1 @@ -0,0 +1,17 @@ +param( + [Parameter(Mandatory=$true)] + [string]$newTarget +) + +Write-Host "Updating TargetFrameworks to $newTarget..." + +Get-ChildItem -Recurse -Filter *.csproj | ForEach-Object { + $content = Get-Content $_.FullName -Raw + if ($content -match '.*?') { + $content = $content -replace '.*?', "$newTarget" + Set-Content -Path $_.FullName -Value $content -NoNewline + Write-Host "Updated $($_.FullName)" + } +} + +Write-Host "Done updating TargetFrameworks."