AzureSignTool icon indicating copy to clipboard operation
AzureSignTool copied to clipboard

Azure DevOps with multiple files (filelist and relative path)

Open bertstomphorst opened this issue 1 year ago • 2 comments

When using Azure DevOps build (in my case on a public agent), it seems to be a bit dubious to fill my filelist.txt with a fixed path (D:\a\1\a<filename>.exe) on each line, while that path is not quaranteed. Is there a way to use -ifl parameter with AzureDevOps, i.e. using a base-path as parameter or a pipelinevariable $(build.artifactstagingdirectory)? For now I've added all files as individual parameters. This works, but isn't as maintainable as we would like.

In sourcecode I found that wildcards are supported, but passing with wildcard (*) like $(build.artifactstagingdirectory)\folder\prefix.*.exe is not accepted (output: File 'D:\a\1\a\folder\prefix.*.exe' does not exist.)

When checking sourcecode, I found the SignCommand.AllFiles-property, with does a Matcher.Execute on Directory '.'. So there seems to be no way to specify a root-directory, and using wildcards results in results.HasMatches to be false.

Any ideas on this topic?

bertstomphorst avatar May 23 '24 07:05 bertstomphorst

A coworker of mine came up with a nice line within the PowerShell script referenced in the AzureCLI pipeline task. It does what you're looking for in terms of creating a local text file with the file paths populated without hardcoding paths. That file is then passed to the subsequent call to azuresigntool via the --input-file-list or -ifl parameter. This solved the issue of including multiple files that don't follow a simple file globbing pattern where input file is needed.

Get-ChildItem -Path "$(Build.SourcesDirectory)\bin\Release\net8.0\win-x64\publish\*" -Include "CompanyName.*.dll", "CompanyName.*.exe", "SomeOtherName.dll", "AnotherName.dll" | Select-Object -ExpandProperty FullName | Out-File "FilesToSign.txt"

aaronmilbrath avatar Dec 11 '24 17:12 aaronmilbrath

While file globbing was implemented, it seems like absolute paths are not supported by Microsoft.Extensions.FileSystemGlobbing

See https://github.com/dotnet/runtime/issues/62333

jespersh avatar Apr 29 '25 07:04 jespersh