How to access NuGet when NuGet.org is down (or you're on a plane)
I was in Dallas today speaking at the Dallas Day of .NET. During my keynote presentation - it included lots of NuGet demos - and for some reason the NuGet.org site was down at that exact moment. I ended up coming up in the middle somewhere. I'm not in Redmond so I don't know what happened and I won't speak for the team. However, my initial reaction was "I'm screwed" and the crowd was interested in how I was going to continue. We all depend on NuGet (the system) and NuGet.org (the server). I know that the team is aiming for "5 nines" availability with the NuGet.org site and that it runs in Azure now. I assume they'll put an explanation of the issue up on the site soon.
Regardless, you might think I was stuck. Well, remember that NuGet caches the packages it downloads on your local hard drive. My cache was located at C:\Users\scottha\AppData\Local\NuGet\Cache.
You can add that cache folder as a NuGet Source by going to Options | Package Manager | Package Sources. You can see I added it in my dialog below.
Then later, when I'm using NuGet offline I can select my cache if need be. Again, I should never need to, but you get the idea:
If you're concerned about external dependencies on a company-wide scale, you might want to have a network share (perhaps on a shared builder server) within your organization that contains the NuGet packages that you rely on. This is a useful thing if you are in a low-bandwidth situation as an organization.
If you think a feature that makes offline a more formal state is useful, please go vote up this "offline" issue on NuGet's CodePlex site and join the conversation with ideas on how you think "NuGet on an airplane" or "low/no bandwidth NuGet" should work. For example, should it automatically fall back? Should there be a timeout? Should there by an -offline explicit option? Should the existing Offline Cache be added automatically?
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.
About Newsletter
What a great move that was! Nerds survive on tips and hidden details in common technologies!
+1
How did I not know about this?? I live in Las Colinas, I definitely would have been there.
"...how is it a cache if it's not checked automatically?"
I'm with Derek; why is Nuget caching the packages locally in the first place if the intent is not to be able to install them from there without needing access to the external server? Is it just there as a stop gap because they knew people would get in this situation, but they haven't had time to implement a better solution?
Are you using VS11 as your main IDE?
/* Off Topic Comment
When will you come to Buenos Aires for an event organized by Microsoft?
Last year in a break I I talked with Phil Haack personally.
I'd like to meet and chat with you.
*/
Greetings from Argentina.
Francisco
Handled it like a boss.
Also the Keynote was great! I had so much fun at the Day of .NET
One note: I recently re-installed Windows on my PC. This obviously cleared my Users folder, and I lost the cached packages. However because my own custom repository is located on a different partition, I didn't lose those packages. Is there any way to change the location of the automatic cache?
Thanks
But you were spot on as I expected you to be.
And you proved me right...Great! Liked it :)
In this case, as well as the case where I have to update 6 nuget packages after file | new | mvc 4 app to get the current versions of the jQuery, ko, etc. this is pretty silly. Hopefully this will be addressed in VS11 by RTM
i.e. I would like to see this update occur and take effect on all future new projects.
http://knowyourmeme.com/memes/fck-yea
Don't get me wrong (I admire you a lot), but one of the preparation steps for any presentation that is going to use NuGet is to have all the packages you will need during the demos on a local folder that you can use as a Package Source.
I'm sure you already do that (probably that Dropbox folder) and just forgot to mention in the post.
It just doesn't feel right to imagine that THE ScottHa was saved by NuGet Cache instead of his own local cache that was previously thought about and planned before leaving home, you know? :)
I think I really am 'screwed'.
Comments are closed.