Skip to main content

Pipeline - building offline packages

I had trouble linking packages in the pipeline which blocked building solutions.
The shortest path I could find, was to update configuration to look into my defined folder.
And get a zipfile from an online resource, and extract it into this folder.

 

Update the configuration

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="globalPackagesFolder" value=".\Packages" />
    <add key="repositoryPath" value=".\Packages" />
  </config>
  <packageSources>
    [....]

 

Define your pipeline task

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      Invoke-WebRequest 'https://dl.dropboxusercontent.com/scl/fi/XXXXXXX8vl&dl=0' -OutFile '$(Build.ArtifactStagingDirectory)/NuGetPackages.zip'
- task: ExtractFiles@1
  inputs:
    archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/NuGetPackages.zip'
    destinationFolder: '.\Packages\NuGetPackages'
    cleanDestinationFolder: true
    overwriteExistingFiles: false