Skip to content

Commit d2de35f

Browse files
Refactor signtool.exe discovery to dynamically find latest version on Windows VMs (#5)
* Initial plan * Refactor signtool.exe discovery and add manual trigger with skip publish option Co-authored-by: turbobobbytraykov <[email protected]> * Set releaseTag to '0.0.0.0' for testing purposes Co-authored-by: turbobobbytraykov <[email protected]> * Remove workflow dispatch and releaseTag changes, keep only signtool.exe discovery improvements Co-authored-by: turbobobbytraykov <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: turbobobbytraykov <[email protected]>
1 parent 9eb0b69 commit d2de35f

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

azure-pipelines/build-and-publish.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,31 @@ stages:
6565
$dllFolder = "$(Build.SourcesDirectory)\bin\$(buildConfiguration)\net9.0"
6666
Write-Host "Signing DLLs in folder: $dllFolder"
6767
68-
$signtoolPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\signtool.exe"
68+
# Find the latest signtool.exe
69+
Write-Host "##[section]Starting search for signtool.exe at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss.fff')"
70+
71+
$signtoolPath = $null
72+
$searchPaths = @(
73+
"C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe",
74+
"C:\Program Files (x86)\Windows Kits\10\bin\*\x86\signtool.exe",
75+
"C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\*\signtool.exe",
76+
"C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\signtool.exe"
77+
)
78+
79+
foreach ($searchPath in $searchPaths) {
80+
$foundPaths = Get-ChildItem -Path $searchPath -ErrorAction SilentlyContinue | Sort-Object -Property FullName -Descending
81+
if ($foundPaths) {
82+
$signtoolPath = $foundPaths[0].FullName
83+
break
84+
}
85+
}
86+
87+
if (-not $signtoolPath) {
88+
Write-Error "signtool.exe not found in any of the well-known locations"
89+
exit 1
90+
}
91+
92+
Write-Host "##[section]Found signtool.exe at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss.fff')"
6993
Write-Host "Using signtool at: $signtoolPath"
7094
7195
$dllFiles = Get-ChildItem -Path $dllFolder -Filter *.dll -Recurse

0 commit comments

Comments
 (0)