The artifactignore file works similarly to a gitignore file but serves a different purpose. Instead of specifying files to be ignored by Git, it's used in Azure Pipelines to control which files are excluded when publishing pipeline artifacts or Universal Packages. This file can help reduce your pipeline execution and improve its efficiency by preventing unnecessary files from being copied into the staging directory before publishing.
The artifactignore file has a similar syntax to that of a gitignore file and is typically stored in your version control system. However, unlike gitignore, the artifactignore file doesn't always need to be in the root of your repository. Its location depends on the path specified in the publish task. If placed incorrectly, the task won't recognize it, leading to unintended results. For example, if the path is $(System.DefaultWorkingDirectory)/bin/artifacts, the artifactignore file should be placed in the /bin/artifacts directory.
The .artifactignore follows the same syntax as the .gitignore with a few exceptions. The plus sign character + is not supported in URL paths, and certain package types, such as Maven, may have limitations with semantic versioning metadata.
Note
By default, the .gitignore file is ignored unless you have an .artifactignore file. To include it, simply create an empty .artifactignore file.
Example
In this example, all files will be ignored except for those located in the src/MyApp/bin/Release directory.
artifactignore
**/*
!src/MyApp/bin/Release/**.*
მნიშვნელოვანი
The .artifactignore file must be placed in the directory specified in the targetPath argument in your Publish Pipeline Artifacts task.
შემოუერთდით Meetup სერიას, რათა შექმნათ მასშტაბური AI გადაწყვეტილებები რეალურ სამყაროში გამოყენების შემთხვევებზე დაყრდნობით თანამემამულე დეველოპერებთან და ექსპერტებთან.