Friday, November 22, 2019

Create Pipeline build to Push DLL into Nuget Repository using Azure DevOps


Here simple steps to follow and create new Automated Build using Azure DevOps to push your DLLs into NuGet Repository 

You mainly needed three task to Restore, Pack and Push library into NuGet repository.

Go to Pipeline > Build > Create New Build , Add following Task on your build 

  1. Get a Sources
    1. Choose Repository (TFVC or Git)
  2. Add Agent Job
    1. NuGet Tool Installer : leave all default
                                                    i.     Type: Map
                                                   ii.     Server Path: choose source code location
                                                  iii.     Clean: true
                                                  iv.     Clean Options: sources
                                                   v.     Label sources: OnSuccess
                                                  vi.     Label format: $(Build.BuildNumber)
    1. NuGet  for Restore
                                                    i.     Choose command : restore
                                                   ii.     Path to solution, packages.config, or project.json (.sln file path)
                               iii.     Use packages from this Azure Artifacts/TFS feed
                                iv.     Check: Use packages from NuGet.org
    1. Update AssemblyInfo
                                                    i.     Root Folder: $(Build.SourcesDirectory)
                                                   ii.     File pattern (AssemblyInfo.cs)
                                                  iii.     Version: $(Build.BuildNumber)
                                                  iv.     File Version: $(Build.BuildNumber)
    1. Visual Studio Build
                                                    i.     Solution :   .sln file path
                                                   ii.     Visual Studio Version: Latest
                                                  iii.     Platform : AnyCPU
                                                  iv.     Configuration: Release
                                                   v.     Check: Clean
    1. NuGet (for pack)
                                                    i.     Command: pack
                                                   ii.     Path for proj or nuspec
                                                  iii.     Pack Option: “Use the build number”
    1. NuGet (for Push)
                                                    i.     Command : push
                                                   ii.     Path to NuGet package to publish ($(Build.ArtifactStagingDirectory)/*.nupkg)
                                                  iii.     Target Feed: Select a feed hosted in this account. You must have Package Management installed and licensed to select a feed here.”

Go to this video for more details 

No comments: