0

I have a hard time getting any information on how to do this.

I want to include a task in my build pipeline that creates an XML file that lists each file of the resulting artifact along with some metadata like checksum, size, etc.

Something like this:

<files>
  <file>
    <name>file1.dll</name>
    <path></path>
    <size></size>
    <checksum></checksum>
  </file>
  <file>
    <name>file2.dll</name>
    <path></path>
    <size></size>
    <checksum></checksum>
  </file>
</files>

I'm thinking I probably need to use a powershell script but how would I go about getting the list of files? I would have to iterate through the list and populate the xml file with that list.

Or is there some task I use to achieve this?

Tralli
  • 398
  • 1
  • 2
  • 12
  • 1
    This seems so use-case specific that its 99.9% likely that you should roll your own, and yes powershell seems appropriate for this. – sommmen Jan 06 '21 at 09:36
  • Hi @Tralli, How are things going? Have you tried the suggestion in my answer? Is it helpful to you? Please try it, and any progress, feel free to tell me. – Bright Ran-MSFT Jan 29 '21 at 06:38

1 Answers1

0

Place the resulting artifact files into a specific directory on the agent, such as $(Build.ArtifactStagingDirectory).

In this directory, you can try the steps below:

  1. List all files in the directory and subdirectories using the PowerShell command Get-ChildItem.

    Get-ChildItem -Attributes !Directory -Path path/to/dir -Recurse -Name
    
  2. In a loop, do the following operations for each files:

Bright Ran-MSFT
  • 5,190
  • 1
  • 5
  • 12