{"id":20065,"date":"2018-03-21T14:38:00","date_gmt":"2018-03-21T14:38:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/premier_developer\/?p=20065"},"modified":"2019-02-14T20:18:22","modified_gmt":"2019-02-15T03:18:22","slug":"use-visual-studio-team-services-vsts-to-host-your-private-package-server","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/use-visual-studio-team-services-vsts-to-host-your-private-package-server\/","title":{"rendered":"Use Visual Studio Team Services (VSTS) to host your private package server"},"content":{"rendered":"<p>In this post, App Dev Manager <a href=\"https:\/\/www.linkedin.com\/in\/keithbeller\/\">Keith Beller<\/a> demonstrates how to use VSTS to host a private package server.<\/p>\n<hr>\n<p>Before you go through the trouble of setting up a private package server to host your <a href=\"https:\/\/www.nuget.org\/\">Nuget<\/a>, <a href=\"https:\/\/www.npmjs.com\/\">NPM<\/a>, <a href=\"https:\/\/maven.apache.org\/guides\/introduction\/introduction-to-the-lifecycle.html\">Maven<\/a> or <a href=\"https:\/\/gradle.org\/\">Gradle<\/a> feeds, consider using Visual Studio Team Services (VSTS). The Microsoft Package Management plugin found in the VSTS Marketplace is easy to use <u>and only takes a couple of minutes to set up.<\/u> I\u2019ll walk you through the configuration process using a NuGet with Visual Studio scenario to guide you step-by-step. I\u2019ll assume you already have a VSTS account, but if not click <a href=\"https:\/\/docs.microsoft.com\/en-us\/vsts\/user-guide\/sign-up-invite-teammates\">here<\/a> for our quickstart sign up guide which will walk you through setting up a free account.<\/p>\n<h3>Installing the Package Management Extension<\/h3>\n<p>Once you\u2019ve logged into VSTS, you want to first head over to the VSTS Marketplace.<\/p>\n<p>In the upper right navigate to the Marketplace by clicking on the <u>shopping bag<\/u> then <u>Browse Marketplace.<\/u><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0022.png\"><img decoding=\"async\" width=\"1028\" height=\"537\" title=\"clip_image002\" alt=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image002_thumb2.png\" border=\"0\"><\/a><\/p>\n<p>You\u2019re looking for the Package Management Extension highlighted in red below. Once you\u2019ve found the extension go ahead and click it and follow the installation instructions.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/image65.png\"><img decoding=\"async\" width=\"623\" height=\"484\" title=\"image\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/image_thumb59.png\" border=\"0\"><\/a><\/p>\n<p>Selected your install option and the install process will take about a minute to complete. Once finished you\u2019re ready to move forward and begin configuring you Feed.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image007.png\"><img decoding=\"async\" width=\"1028\" height=\"640\" title=\"clip_image007\" alt=\"clip_image007\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image007_thumb.png\" border=\"0\"><\/a><\/p>\n<h3>Creating your host feed<\/h3>\n<p>If you navigate to the Build and Release header menu item, you will see a new sub tab named <u>Packages<\/u>. Go ahead and click the menu to reveal the New feed creation page. Click the <u>+ New feed<\/u> button to proceed. <\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image009.png\"><img decoding=\"async\" width=\"987\" height=\"772\" title=\"clip_image009\" alt=\"clip_image009\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image009_thumb.png\" border=\"0\"><\/a><\/p>\n<p>For this demonstration I\u2019m going to create a new private feed called \u201cNugetFeed\u201d that only uses packages published to this feed as shown below. Click Create to continue the process.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image011.png\"><img decoding=\"async\" width=\"1003\" height=\"772\" title=\"clip_image011\" alt=\"clip_image011\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image011_thumb.png\" border=\"0\"><\/a><\/p>\n<p>Alright the feed has been set up and you\u2019re now ready to connect your feed to Visual Studio. Let go ahead and do that.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image013.png\"><img decoding=\"async\" width=\"714\" height=\"772\" title=\"clip_image013\" alt=\"clip_image013\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image013_thumb.png\" border=\"0\"><\/a><\/p>\n<h3>Connecting to the feed<\/h3>\n<p>Start the process by clicking on the <u>connect to feed<\/u> button. A modal popup window will appear giving you several connection options. In this case we are going to utilize the NuGet to Visual Studio connection option. Copy the source URL and hold on to it. Your going to need that URL to connect your feed into Visual Studio.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/feed1.png\"><img decoding=\"async\" width=\"911\" height=\"772\" title=\"feed1\" alt=\"feed1\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/feed1_thumb.png\" border=\"0\"><\/a><\/p>\n<p>If you\u2019ve not already done so, open up Visual Studio and open the Tools &gt; Options menu. We\u2019re going to add that URL you copied to the list of available NuGet feeds. Use the VS search bar to quickly access the configuration screen.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image017.jpg\"><img decoding=\"async\" width=\"1028\" height=\"529\" title=\"clip_image017\" alt=\"clip_image017\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image017_thumb.jpg\" border=\"0\"><\/a><\/p>\n<p>Click the plus button to add you new feed. Set the Source to the URL you copied from the Package connection pop up and give the feed a memorable name. <\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0191.png\"><img decoding=\"async\" width=\"1028\" height=\"736\" title=\"clip_image019\" alt=\"clip_image019\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image019_thumb1.png\" border=\"0\"><\/a><\/p>\n<p>Now we need to see up our build, release and feed.<\/p>\n<h3>Configure your Build, Release and Feed for Consumption<\/h3>\n<p>First we are going to configure our build so let\u2019s start by selecting a source. We\u2019re going to leave the defaults so let\u2019s hit continue.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image021.png\"><img decoding=\"async\" width=\"857\" height=\"772\" title=\"clip_image021\" alt=\"clip_image021\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image021_thumb.png\" border=\"0\"><\/a><\/p>\n<p>In this example my Library targets the .NET Core 2 framework so in this case we are using the ASP.NET Core template. Go a head and select it and hit Apply.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image023.png\"><img decoding=\"async\" width=\"1028\" height=\"454\" title=\"clip_image023\" alt=\"clip_image023\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image023_thumb.png\" border=\"0\"><\/a><\/p>\n<p><b><\/b><\/p>\n<p>The initial template looks like this, but we\u2019re going to change a few things.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0251.png\"><img decoding=\"async\" width=\"1028\" height=\"598\" title=\"clip_image025\" alt=\"clip_image025\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image025_thumb1.png\" border=\"0\"><\/a><\/p>\n<p>First, I configure each step to use Version 2.* like so. You\u2019ll do this for every step except for Publish Artifact.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image0271.png\"><img decoding=\"async\" width=\"1028\" height=\"438\" title=\"clip_image027\" alt=\"clip_image027\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image027_thumb1.png\" border=\"0\"><\/a><\/p>\n<p>Next, we need to modify the Publish step so that it builds our NuGet package. In the command dropdown change the command to pack. For clarity, change the Display name to Pack as well. Also, under the Pack options section, I\u2019ve selected Automatic package versioning \/ Use the date and time. Once you\u2019ve completed these step go ahead and save your build and run it.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image029.png\"><img decoding=\"async\" width=\"1028\" height=\"709\" title=\"clip_image029\" alt=\"clip_image029\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image029_thumb.png\" border=\"0\"><\/a><\/p>\n<p>If you\u2019ve done everything correctly your project should build successfully. Navigate to your Artifacts Explorer to confirm you\u2019ve created the *.nupkg in the drop directory similar to the screenshot below.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image031.png\"><img decoding=\"async\" width=\"1028\" height=\"703\" title=\"clip_image031\" alt=\"clip_image031\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image031_thumb.png\" border=\"0\"><\/a><\/p>\n<p>Now we are ready to set up the release which will have just one task. My release definition looks like this. I\u2019ve selected our Artifacts source, set the Continuous deployment trigger so every successful build is auto released and renamed the Environment to \u201cPackages\u201d for clarity. Your definition should looks something like this. <\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image033.png\"><img decoding=\"async\" width=\"991\" height=\"772\" title=\"clip_image033\" alt=\"clip_image033\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image033_thumb.png\" border=\"0\"><\/a><\/p>\n<p>Now navigate over to the Tasks tab and add a single .NET Core task to your process. Select the Task and modify it so the Display name is \u201cPush\u201d, Command is set to \u201cnuget push\u201d and the Target Feed is set to the name of your feed. My feed name is \u201cNugetFeed\u201d as selected below. Now there is one last configuration you need to set and that is the Path to the NuGet package(s) to publish. Click the ellipsis button next to the field and navigate the full path to your nupkg file and select it. Replace the name of the nupkg file with an * because the file name will change as you release new successful builds. Save this and kick of your release. <\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image035.png\"><img decoding=\"async\" width=\"1000\" height=\"772\" title=\"clip_image035\" alt=\"clip_image035\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image035_thumb.png\" border=\"0\"><\/a><\/p>\n<p>Once the release has completed successfully click the Packages tab and you should see your package. Congratulations, you\u2019ve successfully set up Package Management.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image037.png\"><img decoding=\"async\" width=\"1028\" height=\"438\" title=\"clip_image037\" alt=\"clip_image037\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image037_thumb.png\" border=\"0\"><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image039.png\"><img decoding=\"async\" width=\"1028\" height=\"471\" title=\"clip_image039\" alt=\"clip_image039\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/clip_image039_thumb.png\" border=\"0\"><\/a><\/p>\n<p>Note: by default the package is assigned a Prerelease designation. Now we\u2019re ready to use the package in Visual Studio.<\/p>\n<h3>Connect to the package in Visual Studio<\/h3>\n<p>Let\u2019s test this out. Create a new consumer application in Visual Studio and Manage NuGet packages for the Solution\u2026<\/p>\n<p>Change the Package source to the name of the Feed you added at the beginning of the process. Check the Include prelease box and you\u2019re Package is ready for use.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/image63.png\"><img decoding=\"async\" width=\"1028\" height=\"290\" title=\"image\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/31\/2019\/04\/image_thumb58.png\" border=\"0\"><\/a><\/p>\n<p>Happy coding!<\/p>\n<hr width=\"100%\" size=\"1\" align=\"center\">\n<p><a href=\"https:\/\/blogs.msdn.com\/b\/premier_developer\/archive\/2014\/09\/15\/welcome.aspx\"><strong>Premier Support for Developers<\/strong><\/a> provides strategic technology guidance, critical support coverage, and a range of essential services to help teams optimize development lifecycles and improve software quality.&nbsp; Contact your Application Development Manager (ADM) or <a href=\"https:\/\/blogs.msdn.microsoft.com\/premier_developer\/contact-us\/\">email us<\/a> to learn more about what we can do for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, App Dev Manager Keith Beller demonstrates how to use VSTS to host a private package server. Before you go through the trouble of setting up a private package server to host your Nuget, NPM, Maven or Gradle feeds, consider using Visual Studio Team Services (VSTS). The Microsoft Package Management plugin found in [&hellip;]<\/p>\n","protected":false},"author":582,"featured_media":37840,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[34,3,38],"class_list":["post-20065","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-permierdev","tag-alm","tag-team","tag-vsts"],"acf":[],"blog_post_summary":"<p>In this post, App Dev Manager Keith Beller demonstrates how to use VSTS to host a private package server. Before you go through the trouble of setting up a private package server to host your Nuget, NPM, Maven or Gradle feeds, consider using Visual Studio Team Services (VSTS). The Microsoft Package Management plugin found in [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/20065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=20065"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/20065\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/37840"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=20065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=20065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=20065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}