Private NuGet Package Manager in Visual Studio Team Services
How to install and use Microsoft's official add-in to host a private NuGet package inside of VSTS.
Join the DZone community and get the full member experience.Join For Free
one of the cool feature of visual studio team services is extendibility, you can also find lots of addin in official marketplace . one of the coolest add-in's you can find there is an official add-in by microsoft and allows you to host a private nuget packages inside your vsts account . you can find the add-in here: https://marketplace.visualstudio.com/items?itemname=ms.feed it is free and can be installed with a couple of simple clicks.
figure 1: package manager add a new package menu to your vsts account
as you can see the package manager is still considered to be in preview (asterisk after the menu and a nice toolbar that link to the documentation ), but you can use it because all the basic funcionalities are present.
one of the nice aspect of package management is security: you can publish private packages, and you can decide who can access that specific package . you can start pressing the “new feed” button in the feed page to create a new feed.
figure 2: create a new feed.
after the feed is created, you can simply right-click it and choose edit to manage security with great granularity. as you can see in figure 3 you can specify who owns the feed, who can publish packages to the feed, and finally who can read packages from that feed . with this level of granularity, you can easily protect your packages from unwanted use.
figure 3: package management security page.
once the feed is created, you can press the “connect to feed” link to gather all the information needed to consume and publish packages. you can find instruction for vs2015, vs2013 or other tools / nuget versions.
figure 4: instruction on how to connect to the feed for visual studio 2015.
once the feed is created the easiest way to populate it is using a tfs build, the whole process is explained on the post publishing a nuget package to nuget/myget with vso build vnext .
the main difference is that a private feed can use standard vsts authentication, you just configure the feed as internal nuget feed and put the address of the feed in nuget publisher task configuration. you can see from figure 3 that project collection build service is included in the contributor list, this allows a build service to publish packages to that feed during a build.
figure 5: nuget publisher task can publish internal nuget feed without the need for authentication.
once the build is finished, you can simply check if the package was correctly published to the feed.
figure 6: check your published package in feed management.
you can now consume the package from whatever client you like: visual studio, command line, etc.
Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.