इसके माध्यम से साझा किया गया


Copy and Publish Build Artifacts task

TFS 2017 | TFS 2015

Use this task 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.

Important

This task is deprecated. If you're using Team Foundation Server 2017 or newer, we recommend that you use Pipeline Artifacts.

Use this task only if you're using Team Foundation Server (TFS) 2015 RTM. You can find this task under the Build category Publish Build Artifacts.

Demands

None

Arguments

Argument Description
Copy Root

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 $(Build.SourcesDirectory)).

If your build produces artifacts outside of the sources directory, specify $(Agent.BuildDirectory) to copy files from the build agent working directory.

Contents

Specify pattern filters (one on each line) that you want to apply to the list of files to be copied. For example:

  • ** copies all files in the root folder.
  • **\* copies all files in the root folder and all files in all sub-folders.
  • **\bin copies files in any sub-folder named bin.
Artifact Name Specify the name of the artifact. For example: drop
Artifact Type

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.

Task control options

FAQ

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.

You can avoid these issues by instead using the Copy Files task and the Publish Build Artifacts task.

Q: I'm having issues with publishing my artifacts. How can I view the detailed logs?

To enable detailed logs for your pipeline:

  1. Edit your pipeline and select Variables
  2. Add a new variable with the name System.Debug and value true
  3. Save

Q: Which variables are available to me?

A: $(Build.SourcesDirectory) and $(Agent.BuildDirectory) are just few of the variables you can use in your pipeline. Variables are available as expressions or scripts.

See Define variables, predefined variables, and Classic release and artifacts variables to learn about the different types of variables.

Q: Task allows me to publish artifacts in deployment job in yaml pipeline, but I am not able to use it in downstream pipeline?

A: Deployment jobs do not have the context of source branches and are hence not appropriate for publishing artifacts. They have been primarily designed to consume artifacts. A workaround would be to isolate that logic into a separate job (with dependencies on your deployment jobs).

I use TFS on-premises and I don't see some of these features. Why not?

Some of these features are available only on Azure Pipelines and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.