Using private NuGet Feed

If you want to use custom assemblies as NuGet packages in Visual Studio and your DevOps pipelines, you will have to add your assembly to the Assemblies folder in DevOps (dev.azure.com) first.

In DevOps, select  Assemblies, Connect to Feed  and click Visual Studio, you will see the path you need under Source. For example:

https://pkgs.dev.azure.com/%5Bcustomer%5D/_packaging/Shared%40Local/nuget/v3/index.json

Next you can go to Visual Studio:

  • Go to Tools > NuGet Package Manager > Package Manager Settings, select Package Manager Sources and then click the + button.
  • Choose feed Name (i.e. client shared), set the feed URL to the URL mentioned above.

Error when adding NuGet packages

You may run into an error when adding a NuGet package via the context menu of the References folder. The error I got, was: “Could not find a part of the path ‘C:\pb.bvgo-appservices\VW.Archibus.GatewayService\lib’”. I found out that this error can (for some strange reason) occur when your solution is added to TFS. The solution is to unbind your solution from TFS, add the NuGet packages and then rebind the solution. Go to: File -> Source Control -> Advanced -> Change Source Control to bind and unbind.

Using NuGet

One of the advantages of using NuGet is that you don’t have to ship all the libraries in your project, reducing the project size. With NuGet Power Tools, by specifying the package versions in the Packages.config file, you will be able to download all the required libraries the first time you run the project. Always run these steps after you open an existing solution:

1. Click the Project menu and select Manage NuGet Packages.
2. In the Manage NuGet Packages dialog, click Restore in order to download missing packages.
3. Finally, build the solution by clicking Build | Build Solution.