Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

Task: Refactor signtool.exe path discovery in build-and-publish.yml

Refactoring the inline script on lines 64-78 of build-and-publish.yml to dynamically find the latest signtool.exe on Windows VM.

Changes Made:

Dynamic signtool.exe Discovery

  • Removed: Hardcoded path C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\signtool.exe
  • Added: Dynamic search logic that checks multiple well-known locations:
    • C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe
    • C:\Program Files (x86)\Windows Kits\10\bin\*\x86\signtool.exe
    • C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\*\signtool.exe
    • C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\signtool.exe
  • The script sorts found paths in descending order and selects the latest version
  • Added error handling if signtool.exe is not found

Time Measurement Logging

  • Added logging before search: ##[section]Starting search for signtool.exe at [timestamp]
  • Added logging after search: ##[section]Found signtool.exe at [timestamp]
  • Timestamps include milliseconds for precise measurement

Implementation Details

The PowerShell script now:

  1. Logs the start time of the search
  2. Iterates through well-known Windows SDK locations using wildcard patterns
  3. Sorts results in descending order to get the latest version
  4. Breaks on first match to optimize performance
  5. Fails with a clear error message if signtool.exe is not found
  6. Logs the end time after finding the tool

This ensures compatibility with any Windows VM image version without requiring hardcoded SDK version paths.

Original prompt

On build-and-publish.yml:64-78, Refactor this inline script so that it can quickly find the latest signtool.exe on the VM.
Since the windows-latest VM image was changed recently, the hardcoded path we are using here is no longer valid and I need this script to dynamically determine where the latest signtool.exe is.
Add a logging line before and after the signtool.exe is found so I can easily gauge how much time does finding it take.
Keep in mind that the signtool.exe is in a few rather well-known locations.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ish option

Co-authored-by: turbobobbytraykov <3358260+turbobobbytraykov@users.noreply.github.com>
Copilot AI changed the title Refactor this inline script so that it can quickly find the latest signtool.exe on the VM. Since the windows-latest VM image was changed recently, the hardcoded path we are using here is no longer valid and I need this script to dynamically determine w... Refactor signtool.exe discovery to dynamically find latest version on Windows VMs Nov 11, 2025
Copilot finished work on behalf of turbobobbytraykov November 11, 2025 16:37
@turbobobbytraykov
Copy link
Contributor

@copilot , the build is failing because it's expecting a valid version string to be passed.
Change the value of the releaseTag variable to be '0.0.0.0' for the sake of testing

Co-authored-by: turbobobbytraykov <3358260+turbobobbytraykov@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot , the build is failing because it's expecting a valid version string to be passed.
Change the value of the releaseTag variable to be '0.0.0.0' for the sake of testing

Changed the releaseTag variable value to '0.0.0.0' in commit b6ed708.

Copilot finished work on behalf of turbobobbytraykov November 11, 2025 16:49
@turbobobbytraykov
Copy link
Contributor

@copilot LGTM! Remove the change to the releaseTag variable, as well as the workflow dispatch.
I want just the changes to the inline Powershell script.

…xe discovery improvements

Co-authored-by: turbobobbytraykov <3358260+turbobobbytraykov@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot LGTM! Remove the change to the releaseTag variable, as well as the workflow dispatch.
I want just the changes to the inline Powershell script.

Reverted the workflow dispatch and releaseTag changes in commit 5dbf734. The PR now contains only the signtool.exe discovery improvements.

Copilot finished work on behalf of turbobobbytraykov November 11, 2025 16:57
@turbobobbytraykov turbobobbytraykov marked this pull request as ready for review November 12, 2025 08:40
@turbobobbytraykov turbobobbytraykov merged commit d2de35f into master Nov 12, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants