Utility: Copy and Publish Build Artifacts
Copy build artifacts to a staging folder and then publish them to the server or a file share.
Are you using Visual Studio Team Services (VSTS), Team Foundation Server (TFS) 2015 Update 3, or newer? If so, then we recommend that you do not use this task; it's deprecated. Instead, you should use the Copy Files and Publish Build Artifacts tasks. See Artifacts in Team Build.
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 it's called Publish Build Artifacts.
Files are copied to the
$(Build.ArtifactStagingDirectory) staging folder and then published.
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 Team Build.
Q & A
Q: This step didn't produce the outcome I was expecting. How can I fix it?
This step 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. See Variables.