Search code examples
azure-devopsnugetazure-artifactsazure-devops-server-2019

Can I upload existing NuGet packages to an Azure DevOps artifacts feed?


I'm currently migrating from TFS 2012 to Azure DevOps 2019 (both on-premise). With the old server, I would manually create NuGet packages from some of our builds, and host these .nupkg files on a file share (configured as a package source in Visual Studio). With DevOps, I can obviously automate all of this and push the packages straight into an artifact feed.

The old server needs to be decommissioned, so I would like to move the existing .nupkg files out of the file share into the new artifacts feed. Is this possible?


Solution

  • Yes, you can push existing .npukg files to the new feed.

    You can create a simple PowerShell script that pushes to the feed all your .nupkg files:

    # If you didn't add the new feed to your NuGet sources so add it:
    nuget sources Add -Name "NEW-FEED" -Source "https://pkgs.dev.azure.com/org/_packaging/NEW-FEED/nuget/v3/index.json"
    # Put all the nugets in one folder and move to this folder
    cd path/to/nupkg/folder
    $files = dir
    $files.ForEach({
      push -Source "NEW-FEED" -ApiKey AzureDevOps $_.Name
    })