Home > Enterprise >  how can we change the name of files of build artifacts in azure devops
how can we change the name of files of build artifacts in azure devops

Time:10-27

how can we change the name of files of build artifacts in azure devops below is the picture. i want to change the name of files in drop, want to add build number with the names. enter image description here eg WebApplication1_(buildNumber)

i use the sample project from visual studio, asp.core.webapp enter image description here

also tell me from which file artifact files take the name of the file "WebApplication1". i am using azure devops.

CodePudding user response:

You can just rename your files through PowerShell before publish them:

$projectName = 'WebApplication1'
$projectNewName = 'WebApplication1_$(Build.BuildNumber)'

Get-ChildItem -File -Recurse -Path $(build.artifactstagingdirectory) "$projectName.*" | Rename-Item -NewName { $_.Name -replace "$projectName","$projectNewName" }

The example:

enter image description here

The result:

enter image description here

  • Related