@@ -17,10 +17,37 @@ function Resolve-BuildArtifact {
1717 $separator = [System.IO.Path ]::DirectorySeparatorChar
1818 $configurationSegment = [string ]::Concat($separator , $configuration , $separator )
1919 $targetFrameworkSegment = [string ]::Concat($separator , ' net10.0' , $separator )
20+ $processArchitecture = [System.Runtime.InteropServices.RuntimeInformation ]::ProcessArchitecture.ToString().ToLowerInvariant()
21+ $processArchitectureSegment = [string ]::Concat($separator , $processArchitecture , $separator )
22+ $knownArchitectureSegments = @ (' x86' , ' x64' , ' arm64' ) | ForEach-Object {
23+ [string ]::Concat($separator , $_ , $separator )
24+ }
2025
2126 $candidate = Get-ChildItem - Path $binRoot - Recurse - Filter $AssemblyName - File - ErrorAction SilentlyContinue |
2227 Where-Object { $_.FullName.Contains ($configurationSegment ) -and $_.FullName.Contains ($targetFrameworkSegment ) } |
23- Sort-Object LastWriteTimeUtc - Descending |
28+ Sort-Object `
29+ @ { Expression = {
30+ if ($_.FullName.Contains ($processArchitectureSegment )) {
31+ 2
32+ }
33+ else {
34+ $hasDifferentArchitectureSegment = $false
35+ foreach ($architectureSegment in $knownArchitectureSegments ) {
36+ if ($architectureSegment -ne $processArchitectureSegment -and $_.FullName.Contains ($architectureSegment )) {
37+ $hasDifferentArchitectureSegment = $true
38+ break
39+ }
40+ }
41+
42+ if (-not $hasDifferentArchitectureSegment ) {
43+ 1
44+ }
45+ else {
46+ 0
47+ }
48+ }
49+ }; Descending = $true },
50+ @ { Expression = ' LastWriteTimeUtc' ; Descending = $true } |
2451 Select-Object - First 1
2552
2653 if ($null -eq $candidate ) {
0 commit comments