mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-08-29 10:09:43 +02:00
## Summary of the Pull Request .NET 10 Upgrade. Requires Visual Studio 2026. ## PR Checklist - [x] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments - Upgraded target framework from `net9.0` to `net10.0` across all projects - Removed redundant package references now included by default in .NET 10 - Updated package versions to .NET 10 releases - Modernized regex usage with source generators for better performance - Added `vbcscompiler` to the spell-check allowlist (`.github/actions/spell-check/expect.txt`) ## Validation Steps Performed <!-- START COPILOT CODING AGENT TIPS --> --- 🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security) --------- Co-authored-by: Jeroen van Warmerdam <jeronevw@hotmail.com> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
164 lines
5.4 KiB
PowerShell
164 lines
5.4 KiB
PowerShell
[CmdletBinding()]
|
|
Param(
|
|
[Parameter(Mandatory=$True,Position=1)]
|
|
[string]$path
|
|
)
|
|
|
|
$noticeFile = Get-Content -Raw "NOTICE.md"
|
|
|
|
Write-Host $noticeFile
|
|
|
|
Write-Host "Verifying NuGet packages"
|
|
|
|
$projFiles = Get-ChildItem $path -Filter *.csproj -force -Recurse
|
|
$projFiles.Count
|
|
|
|
Write-Host "Going through all csproj files"
|
|
|
|
$totalList = $projFiles | ForEach-Object -Parallel {
|
|
$csproj = $_
|
|
$nugetTemp = @();
|
|
|
|
#Workaround for preventing exit code from dotnet process from reflecting exit code in PowerShell
|
|
$procInfo = New-Object System.Diagnostics.ProcessStartInfo -Property @{
|
|
FileName = "dotnet.exe";
|
|
Arguments = "list $csproj package --no-restore";
|
|
RedirectStandardOutput = $true;
|
|
RedirectStandardError = $true;
|
|
}
|
|
|
|
$proc = [System.Diagnostics.Process]::Start($procInfo);
|
|
|
|
while (!$proc.StandardOutput.EndOfStream) {
|
|
$nugetTemp += $proc.StandardOutput.ReadLine();
|
|
}
|
|
|
|
$proc = $null;
|
|
$procInfo = $null;
|
|
|
|
if($nugetTemp -is [array] -and $nugetTemp.count -gt 3)
|
|
{
|
|
# Need to debug this script? Uncomment this line.
|
|
# Write-Host $csproj "`r`n" $nugetTemp "`r`n"
|
|
$temp = New-Object System.Collections.ArrayList
|
|
$temp.AddRange($nugetTemp)
|
|
$temp.RemoveRange(0, 3)
|
|
|
|
foreach($p in $temp)
|
|
{
|
|
# ignore "Auto-referenced" string in the output
|
|
if ($p -match "Auto-referenced") {
|
|
continue
|
|
}
|
|
|
|
# breaking item down to usable array and getting 1 and 2, see below of a sample output
|
|
# > PACKAGE VERSION VERSION
|
|
# if a package is Auto-referenced, "(A)" will appear in position 1 instead of a version number.
|
|
|
|
$p = -split $p
|
|
$p = $p[1, 2]
|
|
$tempString = $p[0]
|
|
|
|
if([string]::IsNullOrWhiteSpace($tempString))
|
|
{
|
|
Continue
|
|
}
|
|
|
|
if($tempString.StartsWith("Microsoft.") -Or $tempString.StartsWith("System."))
|
|
{
|
|
Continue
|
|
}
|
|
|
|
echo "- $tempString"
|
|
}
|
|
$csproj = $null;
|
|
}
|
|
} -ThrottleLimit 4 | Sort-Object
|
|
|
|
$returnList = [System.Collections.Generic.HashSet[string]]($totalList) -join "`r`n"
|
|
|
|
Write-Host $returnList
|
|
|
|
# Extract the current package list from NOTICE.md
|
|
$noticePattern = "## NuGet Packages used by PowerToys\s*((?:\r?\n- .+)+)"
|
|
$noticeMatch = [regex]::Match($noticeFile, $noticePattern)
|
|
|
|
if ($noticeMatch.Success) {
|
|
$currentNoticePackageList = $noticeMatch.Groups[1].Value.Trim()
|
|
} else {
|
|
Write-Warning "Warning: Could not find 'NuGet Packages used by PowerToys' section in NOTICE.md"
|
|
$currentNoticePackageList = ""
|
|
}
|
|
|
|
# Test-only packages that are allowed to be in NOTICE.md but not in the build
|
|
# (e.g., when BuildTests=false, these packages won't appear in the NuGet list)
|
|
$allowedExtraPackages = @(
|
|
"- Moq",
|
|
"- MSTest"
|
|
)
|
|
|
|
if (!$noticeFile.Trim().EndsWith($returnList.Trim()))
|
|
{
|
|
Write-Host -ForegroundColor Yellow "Notice.md does not exactly match NuGet list. Analyzing differences..."
|
|
|
|
# Show detailed differences
|
|
$generatedPackages = $returnList -split "`r`n|`n" | Where-Object { $_.Trim() -ne "" } | Sort-Object
|
|
$noticePackages = $currentNoticePackageList -split "`r`n|`n" | Where-Object { $_.Trim() -ne "" } | ForEach-Object { $_.Trim() } | Sort-Object
|
|
|
|
Write-Host ""
|
|
Write-Host -ForegroundColor Cyan "=== DETAILED DIFFERENCE ANALYSIS ==="
|
|
Write-Host ""
|
|
|
|
# Find packages in proj file list but not in NOTICE.md
|
|
$missingFromNotice = $generatedPackages | Where-Object { $noticePackages -notcontains $_ }
|
|
if ($missingFromNotice.Count -gt 0) {
|
|
Write-Host -ForegroundColor Red "MissingFromNotice (ERROR - these must be added to NOTICE.md):"
|
|
foreach ($pkg in $missingFromNotice) {
|
|
Write-Host -ForegroundColor Red " $pkg"
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
# Find packages in NOTICE.md but not in proj file list
|
|
$extraInNotice = $noticePackages | Where-Object { $generatedPackages -notcontains $_ }
|
|
|
|
# Filter out allowed extra packages (test-only dependencies)
|
|
$unexpectedExtra = $extraInNotice | Where-Object { $allowedExtraPackages -notcontains $_ }
|
|
$allowedExtra = $extraInNotice | Where-Object { $allowedExtraPackages -contains $_ }
|
|
|
|
if ($allowedExtra.Count -gt 0) {
|
|
Write-Host -ForegroundColor Green "ExtraInNotice (OK - allowed test-only packages):"
|
|
foreach ($pkg in $allowedExtra) {
|
|
Write-Host -ForegroundColor Green " $pkg"
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
if ($unexpectedExtra.Count -gt 0) {
|
|
Write-Host -ForegroundColor Red "ExtraInNotice (ERROR - unexpected packages in NOTICE.md):"
|
|
foreach ($pkg in $unexpectedExtra) {
|
|
Write-Host -ForegroundColor Red " $pkg"
|
|
}
|
|
Write-Host ""
|
|
}
|
|
|
|
# Show counts for summary
|
|
Write-Host -ForegroundColor Cyan "Summary:"
|
|
Write-Host " Proj file list has $($generatedPackages.Count) packages"
|
|
Write-Host " NOTICE.md has $($noticePackages.Count) packages"
|
|
Write-Host " MissingFromNotice: $($missingFromNotice.Count) packages"
|
|
Write-Host " ExtraInNotice (allowed): $($allowedExtra.Count) packages"
|
|
Write-Host " ExtraInNotice (unexpected): $($unexpectedExtra.Count) packages"
|
|
Write-Host ""
|
|
|
|
# Fail if there are missing packages OR unexpected extra packages
|
|
if ($missingFromNotice.Count -gt 0 -or $unexpectedExtra.Count -gt 0) {
|
|
Write-Host -ForegroundColor Red "FAILED: NOTICE.md mismatch detected."
|
|
exit 1
|
|
} else {
|
|
Write-Host -ForegroundColor Green "PASSED: NOTICE.md matches (with allowed test-only packages)."
|
|
}
|
|
}
|
|
|
|
exit 0
|