Monday, November 21, 2022

[FIXED] how can we change the name of files of build artifacts in azure devops

Issue

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.


Solution

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



Answered By - Shamrai Aleksander
Answer Checked By - Mary Flores (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.