Utility: Archive Files
VSTS | TFS 2018 | TFS 2017
Create an archive file from a source folder. A variety of standard archive formats are supported including: .zip, .jar, .war, .ear, .tar, .7z., and others.
|Root folder (or file) to archive||
The folder (or file) you wish to archive. The default file path is relative from the root folder of the repo (same as if you had specified
If the specified path is a folder, recursively, all nested files and folders will be included in the archive.
If the specified path is a file, only the single file will be included in the archive.
|Prefix root folder name to archive paths||If selected, the root folder name will be prefixed to file paths within the archive. Otherwise, all file paths will start one level lower.
For example, suppose the selected root folder is:
|Archive type||Specify the compression scheme used. To create
|Tar compression||Only applicable if the
Optionally choose a compression scheme, or choose
|Archive file to create||Specify the name of the archive file to create. The file extension should match the selected archive type. For example to create
|Replace existing archive||If an existing archive exists, specify whether to overwrite it. Otherwise, files will be added to it as long as it is not a comprssed tar.
If adding to an existing archive, these types are supported:
- task: ArchiveFiles@2 inputs: # rootFolderOrFile: $(Build.BinariesDirectory) # includeRootFolder: True # archiveType: zip # zip (default), 7z, tar, wim # tarCompression: gz # gz (default), bz2, xz, none # archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip # replaceExistingArchive: true
Q & A
Q: I'm having problems. How can I troubleshoot them?
A: Try this:
On the variables tab, add
system.debugand set it to
true. Select to allow at queue time.
In the explorer tab, view your completed build and click the build step to view its output.
The control options arguments described above can also be useful when you're trying to isolate a problem.
Q: How do variables work? What variables are available for me to use in the arguments?
$(Agent.BuildDirectory) are just a few of the variables you can use. See Variables.
Do I need an agent?
You need at least one agent to run your build or release. Get an agent.