Search code examples
continuous-integrationazure-devopsnuget-packageazure-pipelines-build-taskazure-artifacts

CI and Package Management (Nuget) in VSTS


I am using CI with VSTS. I have about 50 projects in my solution, so there are a lot of dependencies between those projects. I am trying to use the packaging hub of VSTS to create packages for those projects that are referenced by others.

I have created a new feed:

enter image description here

  • I downloaded the bundle
  • Then, added the Nuget Package Source

Lets say that i have three projects A, B and C. Both A and B reference C. So, I need to Create "C" as a package

Questions:

  1. What is "yourpackage.nupkg" in step 3? Is it the project "C" that i need to pack on my local machine?
  2. What is the next step after doing that? How we can add the package to build definition of Both A and B?
  3. How i can automatically update the package when project "C" code changes? I guess there should exist a way to make a build definition publish changes to the Package (of Project "C").

Solution

  • Answers for your question:

    1. What is "yourpackage.nupkg" in step 3? Is it the project "C" that i need to pack on my local machine?

    Yes, it is the nuget package for Project C, you can create it on your local machine or during VSTS build. Refer to this link for details: Creating and Publishing a Package

    1. What is the next step after doing that? How we can add the package to build definition of Both A and B?

    You need to add the nuget package for Project C into Porject A&B, and then in your build definition for Porject A&B, make sure you have a "Nuget Installer" task in previous of the "Visual Studio Build" task to restore the nuget package files for Project C before running build for Project A&B. Refer to this link for details: Consume NuGet packages in Visual Studio

    1. How i can automatically update the package when project "C" code changes? I guess there should exist a way to make a build definition publish changes to the Package (of Project "C").

    You can create a build definition to create nuget package and publish the package to VSTS for Project C and set the build definition to "Continuous integration (CI)". For the steps, you can refer to my answer in this question for defails: Create NuGet Package using MSBuild and VSOnline

    For more detailed information, please refer to this link for details: Use Team Build to restore and publish packages