Use .artifactignore

Azure DevOps Services

The .artifactignore is a text file that controls which files are uploaded when you publish a Universal Package or a Pipeline Artifact.

.artifactignore is typically checked into your version control repository and the syntax is similar to that of .gitignore.

Using the .artifactignore file can help reduce your pipeline execution time by avoiding copying files into your staging directory before publishing your artifacts.


In the following example, we will be ignoring all files except the ones in the src/MyApp/bin/Release directory.



The .artifactignore file must be in the directory provided to the targetPath argument in your Publish Pipeline Artifacts task.


The .artifactignore follows the same syntax as the .gitignore with some minor limitations. The plus sign character + is not supported in URL paths and some of the semantic versioning metadata for some package types like Maven.


The .gitignore file is ignored by default if you don't have an .artifactignore file. You can re-include it by creating an empty .artifactignore file.