Scott Hanselman

How to host your own NuGet Server and Package Feed

April 13, '16 Comments [45] Posted in NuGet | NUnit
Sponsored By

Local NuGet FeedHosting your own NuGet Server, particularly when you're a company or even a small workgroup is a super useful thing. It's a great way to ensure that the build artifacts of each team are NuGet Packages and that other teams are consuming those packages, rather than loose DLLs.

A lot of folks (myself included a minute ago) don't realize that Visual Studio Team Services also offers private NuGet Feeds for your team so that's pretty sweet. But I wanted to try out was setting up my own quick NuGet Server. I could put it on a web server in my closet or up in Azure.

From the NuGet site:

There are several third-party NuGet Servers available that make remote private feeds easy to configure and set-up, including Visual Studio Team Services, MyGet, Inedo's ProGet, JFrog's Artifactory, NuGet Server, and Sonatype's Nexus. See An Overview of the NuGet Ecosystem to learn more about these options.

File Shares or Directories as NuGet Server

Starting with NuGet 3.3 you can just use a local folder and it can host a hierarchical NuGet feed. So I head out to the command line, and first make sure NuGet is up to date.

C:\Users\scott\Desktop>nuget update -self
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 3.3.0.
NuGet.exe is up to date.

Then I'll make a folder for my "local server" and then go there and run "nuget init source dest" where "source" is a folder I have full of *.nupkg" files.

This command adds all the packages from a flat folder of nupkgs to the destination package source in a hierarchical layout as described below. The following layout has significant performance benefits, when performing a restore or an update against your package source, compared to a folder of nupkg files.

There's two ways to run a "remote feed" handled by a Web Server, rather than a "local feed" that's just a file folder or file share. You can use NuGet.Server *or* run your own internal copy of the NuGet Gallery. The gallery is nice for large multi-user setups or enterprises. For small teams or just yourself and your CI (continuous integration) systems, use NuGet.Server.

Making a simple Web-based NuGet.Server

From Visual Studio, make an empty ASP.NET Web Application using the ASP.NET 4.x Empty template.

New Empty ASP.NET Project

Then, go to References | Manage NuGet Packages and find NuGet.Server and install it. You'll get all the the dependencies you need and your Empty Project will fill up! If you see a warning about overwriting web.config, you DO want the remote web.config so overwrite your local one.

Nuget install NuGet.Server

Next, go into your Web.config and note the packagesPath that you can set. I used C:\LocalNuGet. Run the app and you'll have a NuGet Server!

You are running NuGet.Server v2.10.0

Since my NuGet.Server is pulling from C:\LocalNuGet, as mentioned before I can take a folder filled with NuPkg files (flat) and import them with:

nuget init c:\source c:\localnuget

I can also set an API key in the web.config (or have none if I want to live dangerously) and then have my automated build push NuGet packages into my server like this:

nuget push {package file} -s http://localhost:51217/nuget {apikey}

Again, as a reminder, while you can totally do this and it's great for some enterprises, there are lots of hosted NuGet servers out there. MyGet runs on Azure, for example, and VSO/TFS also supports creating and hosting NuGet feeds.

Aside: Some folks have said that they tried NuGet.Server (again, that's the small server, not the full gallery) a few years ago and found it didn't scale or it was slow. This new version uses the Expanded Folder Format and adds significant caching, so if you've only see the "folder full of flat nupkg files" version, then you should try out this new one! It's version 2.10+. How much faster is it? First request to /nuget (cold start, no metadata cache) before was 75.266 sec and after is 8.482 sec!

The main point is that if you've got an automated build system then you really should be creating NuGet packages and publishing them to a feed. If you're consuming another group's assemblies, you should be consuming versioned packages from their feeds. Each org makes packages and they flow through the org via a NuGet server.

Important! If you are using a Network Share with NuGet.Server, make sure you have the newest version because this file folder structure can give you MAJOR performance improvements!

How do YOU handle NuGet in YOUR organization? Do you have a NuGet server, and if so, which one?


Sponsor: Big thanks to RedGate and my friends on ANTS for sponsoring the feed this week!

How can you find & fix your slowest .NET code? Boost the performance of your .NET application with the ANTS Performance Profiler. Find your bottleneck fast with performance data for code & queries. Try it free

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Hanselminutes Podcast 169 - The Art of Unit Testing with Roy Osherove

July 6, '09 Comments [12] Posted in NUnit | Open Source | Podcast | Tools
Sponsored By

ArtOfUnitTesting My one-hundred-and-sixty-ninth podcast is up. In this show recorded in Norway, Roy Osherove educates Scott on best practices in Unit Testing techniques and the Art of Unit Testing.

Also, be sure to check out Roy's talk at the recent Norwegian Developer's Conference, they're quite excellent and worth your time.

Roy's Publisher has given Hanselminutes listeners a code until August 1st, 2009 for 37% off. The code is "hansel37" and it's good at http://www.manning.com and takes the price to US$25.19. Oddly in other ironic news, the book is (tonight at least) $26.39 on Amazon. Go figure.

Links from the Show

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Do also remember the complete archives are always up and they havePDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is a sponsor for this show!

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Hanselminutes Podcast 104 - Dave Laribee on ALT.NET

March 21, '08 Comments [6] Posted in ASP.NET MVC | Learning .NET | Nant | NCover | NUnit | Podcast
Sponsored By

RWS2-Big My one-hundred-and-fourth podcast is up. In this episode I talk to the always thought-provoking David Laribee (blog) who coined the term ALT.NET just last year. It's turned into a Open Spaces Conference and continues to challenge the status quo, reminding .NET developers of the importance of being agile and enabling processes for continuous improvement.

What does it mean to be to be ALT.NET? In short it signifies:

  1. You’re the type of developer who uses what works while keeping an eye out for a better way.
  2. You reach outside the mainstream to adopt the best of any community: Open Source, Agile, Java, Ruby, etc.
  3. You’re not content with the status quo. Things can always be better expressed, more elegant and simple, more mutable, higher quality, etc.
  4. You know tools are great, but they only take you so far. It’s the principles and knowledge that really matter. The best tools are those that embed the knowledge and encourage the principles 

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

If you have trouble downloading, or your download is slow, do try the torrent with µtorrent or another BitTorrent Downloader.

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Check out their UI Suite of controls for ASP.NET. It's very hardcore stuff. One of the things I appreciate about Telerik is their commitment to completeness. For example, they have a page about their Right-to-Left support while some vendors have zero support, or don't bother testing. They also are committed to XHTML compliance and publish their roadmap. It's nice when your controls vendor is very transparent.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Continuous Integration Screencast - Jay Flowers and I on DNRTV

April 29, '07 Comments [7] Posted in Nant | NUnit | Podcast | Programming | Screencasts
Sponsored By

Last week during lunch Jay Flowers and I recorded an episode of "DotNetRocks TV." We are Episode 64 of DNRTV. 

"In this episode of dnrTV, Carl has two guests (Jay Flowers and Scott Hanselman). Essentially Jay Flowers is an expert in Continuous Integration (CI), and the author of CI Factory, a helper application for setting up CI systems. Scott complements Jay as a user of CI Factory, and one who has had to set up CI without it! In this show Jay shows Scott and Carl how to set up a complete CI system with Subversion as the source control system. Jay uses SubText, a popular blog software package, as a demo source project that gets run through the CI system."

Play Flash Version in the Browser
Download zipped video
Download Torrent to Zip
Subscribe with PwopCatcher (read more below)

You remember Jay Flowers, maker of the free CI Factory, a Continuous Integration accelerator, from Hanselminutes show #54. We also talked about CI in February of 2006 on Show #4. Jay and I had said on the show that we really needed to do a visual show to help folks understand Continuous Integration and CI Factory, and this is it.

In this show, we (actually Jay) takes SubText, the popular ASP.NET/SQL Blogging Engine led by Phil Haack, and sets it up for Continuous Integration from a totally fresh machine. He walks us through the process step by step. Even though SubText already has a CI Build setup, we chose it as an example since most folks who want to do Continuous Integration likely have an existing project in mind. We wanted to show how even a fairly complex project like SubText that includes Unit Tests and many projects can be setup for CI in less than an hour. Setting up a build server (without asking your boss) can be a good way to sneak Continuous Integration processes into your company.

Jay worked very hard on preparation for this episode, on his own time, and I want to personally thank him for his work. I hope you enjoy the show.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Hanselminutes Podcast 54 - Squeezing Continuous Integration

March 9, '07 Comments [2] Posted in Nant | NCover | NDoc | NUnit | Podcast | Programming | Tools
Sponsored By

My fifty-fourth podcast is up. In this episode we continue the discussion started in Episode 4 - Continuous Integration. We're fortunate to be joined by Jay Flowers, maker of CI Factory, a Continuous Integration Accelerator that lets you get a continuous integration build running in minutes, not days. It's a generator that creates build scripts, CruiseControl server files, project structure and more. Take a look at version 0.8 and the screencast on installation and setup. We believe that there's more to just Build and Test...you can automate everything and even have your build server pop out ISO images, CDs, or complete configured Virtual Machines. Enjoy.

ACTION: Please vote for us on Podcast Alley! Digg us at Digg Podcasts!

Links from the Show

Jeff finally gets with it (mm0)
Backup Package (mm5)
How to make a CI Factory Package (mma)
Code Churn, Predicting how may bugs (mm1)
Playing for Real, More Than a Scoreboard - Threshold Package (mm6)
CI Factory Installation (mmb)
VSTS Integration (mm2)
Analytics Package - Xsl exsl:document or multi-output (mm7)
Phil Haack A Comparison of TFS vs Subversion for Open Source Projects (mmc)
Updated AsyncExec stuff (mm3)
Analytics Package Screen Capture (mm8)
Traceability and Continuous Integration (mmd)
AsyncExec stuff (mm4)
A Recipe for Build Maintainability and Reusability (mm9)

Subscribe: Feed-icon-16x16 Subscribe to my Podcast in iTunes

Do also remember the archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Our sponsors are Telerik and /n software.

Telerik is a new sponsor. Check out their UI Suite of controls for ASP.NET. It's very hardcore stuff. One of the things I appreciate about Telerik is their commitment to completeness. For example, they have a page about their Right-to-Left support while some vendors have zero support, or don't bother testing. They also are committed to XHTML compliance and publish their roadmap. It's nice when your controls vendor is very transparent.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

  • The basic MP3 feed is here, and the iPod friendly one is here. There's a number of other ways you can get it (streaming, straight download, etc) that are all up on the site just below the fold. I use iTunes, myself, to listen to most podcasts, but I also use FeedDemon and it's built in support.
  • Note that for now, because of bandwidth constraints, the feeds always have just the current show. If you want to get an old show (and because many Podcasting Clients aren't smart enough to not download the file more than once) you can always find them at http://www.hanselminutes.com.
  • I have, and will, also include the enclosures to this feed you're reading, so if you're already subscribed to ComputerZen and you're not interested in cluttering your life with another feed, you have the choice to get the 'cast as well.
  • If there's a topic you'd like to hear, perhaps one that is better spoken than presented on a blog, or a great tool you can't live without, contact me and I'll get it in the queue!

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Page 1 of 10 in the NUnit category Next Page

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.