NuGet Support for Visual Studio 2008
Well, not really. A better title would be "How to Cobble Together NuGet Support for Visual Studio 2008 with External Tools and a Prayer." The point is, there are lots of folks using Visual Studio 2008 who would like NuGet support. I'm exploring this area and there's a half-dozen ways to make it happen, some difficult and some less so. The idea would be to enable some things with minimal effort. It'll be interesting to see if there are folks in the community who think this is important enough to actually make it happen. Of course, the easiest thing is to just use 2010 as it sill supports .NET 2.0, 3.0, 3.5, and 4, but not everyone can upgrade.
Someone could:
- Backport the existing NuGet Package References dialog to 2008 using that version's native extensions (not VSiX)
- Create MEF (Managed Extensibility Framework) plugins for the nuget.exe command-line to update the references in a vbproj or csproj
- Use PowerShell scripts and batch files to get the most basic stuff working (get a package and update references.)
- Maybe write a shim to get DTE automation working...
But that's coulds and maybes. Let's talk about the MacGyver solution.
Launch Visual Studio 2008 and go to Tools | External Tools.
Make a new Tool with these values:
- Title: NuGet Install
- Command (I'm assuming this is in the PATH): nuget.exe
- Arguments: install your.package.name -excludeversion -outputDirectory .\Packages
- Initial directory: $(SolutionDir)
- Use Output window: Checked
- Prompt for arguments: Checked
Next, right click in the Tookbar area and create a new Toolbar called NuGet. From Commands, drag in the correct Tools | External Tool button. Right click it and design to taste:
Now, when you click Install Package, you should change your.package.name to whatever the you want is, and click OK. Note the output in the console window below.
At this point, because we are only integrating the command line too, you don't get the references added automatically. And where's the packages? Well, they are here, one directory up under Packages. It's still up to you to add the reference yourself and make sure it's the appropriate one (I refer you again to the wish list above.)
If you are feeling extra fancy, you can even add a few macros and links in your Toolbar to send you to the NuGet site for searching. Here's a Visual Studio 2008 macro that launches your default web browser and takes you to http://www.nuget.org/List/Packages.
Public Module NuGet
Sub LaunchNuGetSite()
Dim p As New System.Diagnostics.Process()
p.Start("http://www.nuget.org/List/Packages")
End Sub
End Module
Then make toolbar buttons for those extra buttons, like this one for going to the NuGet site and searching:
Thoughts, Dear Reader?
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
Who wants to use VS2008 anyway these days?
Plenty of places are still using VS2005 or even VS6, so don't dismiss solutions for older editions of VS. True, those older editions may not be in use by Web developers, but they are still in use.
As NuGet (from rel 1.3) supports .NET CF it would be nice to have tooling support from Visual Studio 2008.
I still can't stand to use 2010, dog slow pos. I hope they rewrite it again before I have to use it.
If you are still developing on a duo-core machine, with a 32-bit OS or with less that 6G of ram on a quad-core machine, then your VS2010 experience will NOT be a good one.
That said, Is anyone willing to start a codeplex project to develop a VS2008 Extension for NuGet?
- Launch Visual Studio 2008 and go to Tools | External Tools.
Make a new Tool with these values:
* Title: NuGet Install
* Command (I'm assuming this is in the PATH): nuget.exe
Ah, the 3rd step "Command" has "assume" in there,.
OK, where are the "instructions" on getting NuGet put on the system in the *first* place before *ass-U-ME-ing"?
In short, McGyver, the detonator done triggered ages ago ... your finally done for.
Comments are closed.
worked for a few solutions that we tested