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?
Build.SourcesDirectory. The local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s. By default, new build pipelines update only the changed files. Important note: If you check out only one Git repository, this path will be the exact path to the code.
Build numbers in Azure DevOps For example, Microsoft's Build Number format documentation gives an example: $(TeamProject)_$(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:. r) will result in a version number like Fabrikam_CIBuild_main_20090805. 2 .
If you linked a build as release artifact, then you can use $(Build. BuildNumber) to get build number. If you have the issue, please provide the details of your release pipeline (Linked artifact, Docker push task setting, detail log).
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)'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With