Skip to content

Commit fc6ba58

Browse files
🤖 CopilotCopilot
authored andcommitted
Merge latest from Library.Template
Merge the latest Library.Template changes into this repo.\n\nResolved merge conflicts by keeping the repo-specific README, updating the Microsoft.Testing.Platform version while preserving repo-specific package settings, retaining the Microsoft.Build.Traversal SDK entry while taking the newer .NET SDK version, and re-deleting Expand-Template.ps1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2 parents 2147a0d + 11f522e commit fc6ba58

File tree

12 files changed

+152
-140
lines changed

12 files changed

+152
-140
lines changed

.config/dotnet-tools.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"rollForward": false
1111
},
1212
"dotnet-coverage": {
13-
"version": "18.5.2",
13+
"version": "18.6.2",
1414
"commands": [
1515
"dotnet-coverage"
1616
],
@@ -31,7 +31,7 @@
3131
"rollForward": false
3232
},
3333
"nerdbank.dotnetrepotools": {
34-
"version": "1.2.1",
34+
"version": "1.3.13",
3535
"commands": [
3636
"repo"
3737
],

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions
2-
FROM mcr.microsoft.com/dotnet/sdk:10.0.201@sha256:478b9038d187e5b5c29bfa8173ded5d29e864b5ad06102a12106380ee01e2e49
2+
FROM mcr.microsoft.com/dotnet/sdk:10.0.202@sha256:adc02be8b87957d07208a4a3e51775935b33bad3317de8c45b1e67357b4c073b
33

44
# Installing mono makes `dotnet test` work without errors even for net472.
55
# But installing it takes a long time, so it's excluded by default.

.github/actions/publish-artifacts/action.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,46 @@ runs:
1414

1515
- name: 📢 Upload project.assets.json files
1616
if: always()
17-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
17+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
1818
with:
1919
name: projectAssetsJson-${{ runner.os }}
2020
path: ${{ runner.temp }}/_artifacts/projectAssetsJson
2121
continue-on-error: true
2222
- name: 📢 Upload variables
23-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
23+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
2424
with:
2525
name: variables-${{ runner.os }}
2626
path: ${{ runner.temp }}/_artifacts/Variables
2727
continue-on-error: true
2828
- name: 📢 Upload build_logs
2929
if: always()
30-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
30+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3131
with:
3232
name: build_logs-${{ runner.os }}
3333
path: ${{ runner.temp }}/_artifacts/build_logs
3434
continue-on-error: true
3535
- name: 📢 Upload testResults
3636
if: always()
37-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
37+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3838
with:
3939
name: testResults-${{ runner.os }}
4040
path: ${{ runner.temp }}/_artifacts/testResults
4141
continue-on-error: true
4242
- name: 📢 Upload coverageResults
4343
if: always()
44-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
44+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
4545
with:
4646
name: coverageResults-${{ runner.os }}
4747
path: ${{ runner.temp }}/_artifacts/coverageResults
4848
continue-on-error: true
4949
- name: 📢 Upload symbols
50-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
50+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5151
with:
5252
name: symbols-${{ runner.os }}
5353
path: ${{ runner.temp }}/_artifacts/symbols
5454
continue-on-error: true
5555
- name: 📢 Upload deployables
56-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
56+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5757
with:
5858
name: deployables-${{ runner.os }}
5959
path: ${{ runner.temp }}/_artifacts/deployables

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
env:
3636
DocFx: true # Workaround https://github.com/dotnet/docfx/issues/10808
3737
- name: Upload artifact
38-
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
38+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
3939
with:
4040
path: docfx/_site
4141

4242
- name: Deploy to GitHub Pages
4343
id: deployment
44-
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
44+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

.github/workflows/release.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,30 @@ jobs:
4141
4242
Write-Host "Resolved ${{ github.ref_name }} to $commitSha"
4343
44-
$releases = gh run list -R ${{ github.repository }} -c $commitSha -w .github/workflows/build.yml -s success --json databaseId,startedAt `
44+
$releases = gh run list -R ${{ github.repository }} -c $commitSha -w .github/workflows/build.yml -s success --json databaseId,startedAt,event,headBranch `
4545
| ConvertFrom-Json | Sort-Object startedAt -Descending
4646
47+
$preferredReleases = $releases | Where-Object {
48+
$_.event -eq 'push' -and ($_.headBranch -eq 'main' -or $_.headBranch -match '^v\d+(?:\.\d+)?$')
49+
}
50+
4751
if ($releases.length -eq 0) {
4852
Write-Error "No successful builds found for ${{ github.ref }}."
49-
} elseif ($releases.length -gt 1) {
50-
Write-Warning "More than one successful run found for ${{ github.ref }}. Artifacts from the most recent successful run will ship."
51-
}
53+
} else {
54+
if ($preferredReleases.length -gt 0) {
55+
$selectedReleases = $preferredReleases
56+
$multipleRunsWarning = "More than one successful run found for ${{ github.ref }}. Preferring the most recent push build from a public-release branch."
57+
} else {
58+
$selectedReleases = $releases
59+
$multipleRunsWarning = "More than one successful run found for ${{ github.ref }} and none were from a public-release branch. Artifacts from the most recent successful run will ship."
60+
}
5261
53-
$runid = $releases[0].databaseId
62+
if ($releases.length -gt 1) {
63+
Write-Warning $multipleRunsWarning
64+
}
65+
66+
$runid = $selectedReleases[0].databaseId
67+
}
5468
}
5569
5670
Write-Host "Using artifacts from run-id: $runid"

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
66
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
7-
<MicrosoftTestingPlatformVersion>2.1.0</MicrosoftTestingPlatformVersion>
7+
<MicrosoftTestingPlatformVersion>2.2.1</MicrosoftTestingPlatformVersion>
88
<RoslynVersion>5.3.0</RoslynVersion>
99
<RoslynVersionForAnalyzers>4.11.0</RoslynVersionForAnalyzers>
1010
<CodeAnalysisAnalyzerVersion>3.11.0-beta1.26075.3</CodeAnalysisAnalyzerVersion>
@@ -67,7 +67,7 @@
6767
<PackageVersion Update="System.Text.Json" Version="9.0.8" />
6868
</ItemGroup>
6969
<ItemGroup Label="Library.Template">
70-
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.5.2" />
70+
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.6.2" />
7171
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="$(MicrosoftTestingPlatformVersion)" />
7272
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="$(MicrosoftTestingPlatformVersion)" />
7373
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="$(MicrosoftTestingPlatformVersion)" />

global.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"sdk": {
3-
"version": "10.0.201",
4-
"rollForward": "patch",
5-
"allowPrerelease": false
6-
},
7-
"test": {
8-
"runner": "Microsoft.Testing.Platform"
9-
},
10-
"msbuild-sdks": {
11-
"Microsoft.Build.Traversal": "4.1.82"
12-
}
2+
"sdk": {
3+
"version": "10.0.202",
4+
"rollForward": "patch",
5+
"allowPrerelease": false
6+
},
7+
"test": {
8+
"runner": "Microsoft.Testing.Platform"
9+
},
10+
"msbuild-sdks": {
11+
"Microsoft.Build.Traversal": "4.1.82"
12+
}
1313
}

tools/Download-NuGetPackage.ps1

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<#
2+
.SYNOPSIS
3+
Downloads a NuGet package to a local folder using dotnet package download.
4+
.PARAMETER PackageId
5+
The Package ID to download.
6+
.PARAMETER Version
7+
The version of the package to download. If unspecified, the latest version is downloaded.
8+
.PARAMETER Source
9+
An additional package source to search. Used as a fallback alongside the configured feeds.
10+
.PARAMETER OutputDirectory
11+
The directory to download the package to. By default, it uses the obj\tools folder at the root of the repo.
12+
.PARAMETER ConfigFile
13+
The nuget.config file to use. By default, it uses the repo root nuget.config.
14+
.PARAMETER Verbosity
15+
The verbosity level for the download. Defaults to quiet.
16+
.OUTPUTS
17+
System.String. The path to the downloaded package directory.
18+
#>
19+
[CmdletBinding()]
20+
Param(
21+
[Parameter(Position=1,Mandatory=$true)]
22+
[string]$PackageId,
23+
[Parameter()]
24+
[string]$Version,
25+
[Parameter()]
26+
[string]$Source,
27+
[Parameter()]
28+
[string]$OutputDirectory="$PSScriptRoot\..\obj\tools",
29+
[Parameter()]
30+
[string]$ConfigFile="$PSScriptRoot\..\nuget.config",
31+
[Parameter()]
32+
[ValidateSet('quiet','minimal','normal','detailed','diagnostic')]
33+
[string]$Verbosity='quiet'
34+
)
35+
36+
if (!(Test-Path $OutputDirectory)) { New-Item -ItemType Directory -Path $OutputDirectory -Force | Out-Null }
37+
$OutputDirectory = (Resolve-Path $OutputDirectory).Path
38+
$ConfigFile = (Resolve-Path $ConfigFile).Path
39+
40+
$packageArg = $PackageId
41+
if ($Version) { $packageArg = "$PackageId@$Version" }
42+
43+
$extraArgs = @()
44+
if ($Source) { $extraArgs += '--source', $Source }
45+
46+
$prevErrorActionPreference = $ErrorActionPreference
47+
$ErrorActionPreference = 'Continue'
48+
& dotnet package download $packageArg --configfile $ConfigFile --output $OutputDirectory --verbosity $Verbosity @extraArgs 2>&1 | Out-Null
49+
$downloadExitCode = $LASTEXITCODE
50+
$ErrorActionPreference = $prevErrorActionPreference
51+
52+
if ($downloadExitCode -ne 0) {
53+
throw "Failed to download package $packageArg (exit code $downloadExitCode)."
54+
}
55+
56+
# Return the path to the downloaded package directory (dotnet package download uses lowercase id)
57+
$packageIdLower = $PackageId.ToLower()
58+
if ($Version) {
59+
$packageRoot = Join-Path $OutputDirectory $packageIdLower
60+
$packageDir = Get-ChildItem -Path $packageRoot -Directory -ErrorAction SilentlyContinue |
61+
Where-Object { $_.Name -ieq $Version } |
62+
Select-Object -First 1
63+
if ($packageDir) { $packageDir = $packageDir.FullName }
64+
} else {
65+
# When no version is specified, pick the most recently written version directory.
66+
$packageRoot = Join-Path $OutputDirectory $packageIdLower
67+
$packageDir = Get-ChildItem -Path $packageRoot -Directory -ErrorAction SilentlyContinue |
68+
Sort-Object -Property LastWriteTimeUtc -Descending |
69+
Select-Object -First 1
70+
if ($packageDir) { $packageDir = $packageDir.FullName }
71+
}
72+
73+
if ($packageDir -and (Test-Path $packageDir)) {
74+
Write-Output $packageDir
75+
} else {
76+
throw "Package directory not found after download. PackageId='$PackageId'; Version='$Version'; OutputDirectory='$OutputDirectory'; PackageRoot='$packageRoot'."
77+
}

tools/Get-3rdPartySymbolFiles.ps1

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
Function Get-FileFromWeb([Uri]$Uri, $OutFile) {
2-
$OutDir = Split-Path $OutFile
3-
if (!(Test-Path $OutFile)) {
4-
Write-Verbose "Downloading $Uri..."
5-
if (!(Test-Path $OutDir)) { New-Item -ItemType Directory -Path $OutDir | Out-Null }
6-
try {
7-
(New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile)
8-
}
9-
finally {
10-
# This try/finally causes the script to abort
11-
}
12-
}
13-
}
1+
# Symbol servers to search for PDBs, in order of priority.
2+
$SymbolServers = @(
3+
'https://msdl.microsoft.com/download/symbols'
4+
'https://symbols.nuget.org/download/symbols'
5+
)
146

157
Function Unzip($Path, $OutDir) {
168
$OutDir = (New-Item -ItemType Directory -Path $OutDir -Force).FullName
@@ -33,17 +25,31 @@ Function Unzip($Path, $OutDir) {
3325
Function Get-SymbolsFromPackage($id, $version) {
3426
$symbolPackagesPath = "$PSScriptRoot/../obj/SymbolsPackages"
3527
New-Item -ItemType Directory -Path $symbolPackagesPath -Force | Out-Null
36-
$nupkgPath = Join-Path $symbolPackagesPath "$id.$version.nupkg"
37-
$snupkgPath = Join-Path $symbolPackagesPath "$id.$version.snupkg"
3828
$unzippedPkgPath = Join-Path $symbolPackagesPath "$id.$version"
39-
Get-FileFromWeb -Uri "https://www.nuget.org/api/v2/package/$id/$version" -OutFile $nupkgPath
40-
Get-FileFromWeb -Uri "https://www.nuget.org/api/v2/symbolpackage/$id/$version" -OutFile $snupkgPath
4129

42-
Unzip -Path $nupkgPath -OutDir $unzippedPkgPath
43-
Unzip -Path $snupkgPath -OutDir $unzippedPkgPath
30+
# Download the package from configured feeds (failures are non-fatal for symbol collection)
31+
& "$PSScriptRoot\Download-NuGetPackage.ps1" -PackageId $id -Version $version -OutputDirectory $symbolPackagesPath -ErrorAction SilentlyContinue | Out-Null
32+
$global:LASTEXITCODE = 0
33+
$nupkgFile = Get-ChildItem -Recurse -Path $symbolPackagesPath -Filter "$id.$version.nupkg" -ErrorAction SilentlyContinue | Select-Object -First 1
34+
if (!$nupkgFile) {
35+
Write-Warning "Package $id $version not found in configured feeds. Skipping."
36+
return
37+
}
38+
39+
Unzip -Path $nupkgFile.FullName -OutDir $unzippedPkgPath
40+
41+
# Download symbols for each binary using dotnet-symbol
42+
$serverArgs = $SymbolServers | ForEach-Object { '--server-path'; $_ }
43+
$binaries = Get-ChildItem -Recurse -LiteralPath $unzippedPkgPath -Include *.dll, *.exe
44+
foreach ($binary in $binaries) {
45+
$prevErrorActionPreference = $ErrorActionPreference
46+
$ErrorActionPreference = 'Continue'
47+
& dotnet symbol --symbols @serverArgs --output $binary.DirectoryName $binary.FullName 2>&1 | Out-Null
48+
$ErrorActionPreference = $prevErrorActionPreference
49+
}
4450

51+
# Output pairs of binary + PDB paths for archival
4552
Get-ChildItem -Recurse -LiteralPath $unzippedPkgPath -Filter *.pdb | % {
46-
# Collect the DLLs/EXEs as well.
4753
$rootName = Join-Path $_.Directory $_.BaseName
4854
if ($rootName.EndsWith('.ni')) {
4955
$rootName = $rootName.Substring(0, $rootName.Length - 3)
@@ -80,7 +86,9 @@ Function Get-PackageVersion($id) {
8086
}
8187

8288
# All 3rd party packages for which symbols packages are expected should be listed here.
83-
# These must all be sourced from nuget.org, as it is the only feed that supports symbol packages.
89+
# Packages are downloaded from configured feeds in nuget.config.
90+
# We should NOT add 3rd party packages to this list because PDBs may be unsafe for our debuggers to load,
91+
# so we should only archive 1st party symbols.
8492
$3rdPartyPackageIds = @()
8593

8694
$3rdPartyPackageIds | % {

tools/Get-NuGetTool.ps1

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)