Lukas
Lukas

Reputation: 179

Azure DevOps Pipelines: Create a text file with the current build number

I have a build and pipeline setup to build a solution and then upload the finished .exe file via ftp upload to my website. Everything works fine and I have it setup to make a new folder named $Build.BuildNumber (20181218.4 for example) with the .exe file in it so I can keep an archive of my finished builds.

Now I want to write the BuildNumber to a text file sitting somewhere in the root directory with a static path/url so my programms can read the file and get the newest build number and download the newest .exe.

How can I automate the process of creating such a text file with Azure DevOps Pipelines?

Upvotes: 13

Views: 24296

Answers (1)

Channa
Channa

Reputation: 3737

You can create a text file using powershell task.

use following commands inside powershel task

New-Item pathtoFile\test.txt
Set-Content pathToFile\test.txt '$(Build.BuildNumber)'

Upvotes: 22

Related Questions