Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 368
Andrew Stephens Avatar asked Sep 05 '19 08:09

Andrew Stephens


People also ask

How do I add packages to Azure Artifacts?

Select Tools | NuGet Package Manager | Package Manager Settings. Locate the Package Sources section and click the Add button to add a new package source. Set the Name to “PartsUnlimitedShared” and paste the Source URL copied earlier. Click Update followed by OK.

How do I add NuGet package to Azure pipeline?

Restore packages with NuGet restoreNavigate to your classic pipeline definition, and then select Edit. Select + to add a new task. Search for NuGet, and then select Add to add the task to your pipeline. Name your task and select Restore from the Command.


1 Answers

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
})
like image 126
Shayki Abramczyk Avatar answered Sep 28 '22 08:09

Shayki Abramczyk