Copy and Publish Build Artifacts task
Use this task in a build or release pipeline to copy build artifacts to a staging folder and then publish them to the server or a file share.
Files are copied to the
$(Build.ArtifactStagingDirectory) staging folder and then published.
If you're using Azure Pipelines, or Team Foundation Server (TFS) 2017 or newer, we recommend that you do NOT use this deprecated task. Instead, use the Copy Files and Publish Build Artifacts tasks. See Artifacts in Azure Pipelines.
Are you using Team Foundation Server (TFS) 2015.4? If so, we recommend that you do NOT use this deprecated task. Instead, use the Copy Files and Publish Build Artifacts tasks. See Artifacts in Azure Pipelines.
You should use this task only if you're using Team Foundation Server (TFS) 2015 RTM. In that version of TFS, this task is listed under the Build category and is named Publish Build Artifacts.
Folder that contains the files you want to copy. If you leave it empty, the copying is done from the root folder of the repo (same as if you had specified
If your build produces artifacts outside of the sources directory, specify
Specify pattern filters (one on each line) that you want to apply to the list of files to be copied. For example:
|Artifact Name||Specify the name of the artifact. For example:
Choose server to store the artifact on your Team Foundation Server. This is the best and simplest option in most cases. See Artifacts in Azure Pipelines.
Q & A
Q: This step didn't produce the outcome I was expecting. How can I fix it?
This task has a couple of known issues:
Some minimatch patterns don't work.
It eliminates the most common root path for all paths matched.
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.
Variables are available in expressions as well as scripts; see variables to learn more about how to use them.
There are some predefined build and release variables you can also rely on.
I use TFS on-premises and I don't see some of these features. Why not?