I am using Hosted build agents to build my ASP.NET Core application and each time they try to cache packages.
Set DOTNET_SKIP_FIRST_TIME_EXPERIENCE environment variable to true.
Caching packages on a temporary build machine is a waste of time. Upon each new build a new machine is provisioned and therefore will not have the cache from before. Each build will report the following status
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
To prevent this from happening you need to set an environment variable (DOTNET_SKIP_FIRST_TIME_EXPERIENCE) to true on your build machine. If you are using containerized builds with Docker simply pass this value in your run command. If you are using Team Services simply set the value on the variables tab.