76

How can I use NuGet to add a library package reference, when I have Visual C# 2010 Express?

NuGet doesn't come up when I search for it in Tools > Extension Manager.

I downloaded "NuGet Package Manager" (the .vsix) from the downloads page, but when it prompts me for which versions of Visual studio to integrate into, it only lists Visual Web Developer Express 2010. Visual C# Express isn't shown. So I guess it would work with Silverlight in VWD, but I want to use it with WPF.

One of the documentation pages linked me to the 1.0 CTP download page, which included a command-line version of NuGet (no longer present in the latest version). But the command-line version seems to be crippled -- the only operation it seems to support is building a package for distribution; it doesn't seem to support the commands for adding a reference to a library package.

Is there any way at all to use NuGet with Visual C# Express?

Joe White
  • 94,807
  • 60
  • 220
  • 330

4 Answers4

72

Update (9/12/2012): Good news: Visual Studio Express 2012 for Windows Desktop is now available (here), and it supports NuGet out of the box. Generally speaking, every edition of VS2012 now supports NuGet, so this limitation should be a thing of the past!


Original answer:

Microsoft signs NuGet in a way that allows it to work with VWD Express. Ideally, it would also be signed in a way that it works with C# Express (it may have to be a separate build). Unfortunately, we were not able to do this for the initial release (it's more of a challenge than you might think).

Going forward, we will try to enable this scenario. Feel free to file a bug on the NuGet site just to let others who are affected a chance to vote it up!

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • 2
    Would you consider http://nuget.codeplex.com/workitem/184 to cover this? (Of course, it says they're looking at supporting other SKUs for v1 -- apparently that didn't end up making it in.) – Joe White Jan 03 '11 at 01:42
  • Yes, it certainly does, I didn't realize we had a bug. Indeed this did not make v1. Feel free to add you input to that bug, and vote it up if you haven't already. – David Ebbo Jan 04 '11 at 03:23
  • 1
    Is this only an issue with C# express? Meaning does it work with C# professional? – mibollma Apr 02 '12 at 07:55
  • It's only an issue for Express, not Professional. – David Ebbo Apr 02 '12 at 16:40
  • 8
    To summarise: **no you can't** use NuGet with Visual Studio Express. Shame. – Colonel Panic May 14 '12 at 20:51
  • 3
    Kind of a kick in the teeth to a huge portion of the development community. – Brian Cline Aug 30 '12 at 18:45
  • See my updated answer. Hopefully this is now a solved problem! – David Ebbo Sep 13 '12 at 05:53
  • Still doesn't address users that are stuck on VS2010 because of the XNA GameStudio dependency. – Joe Wood Jan 13 '13 at 06:26
  • Visual Web Developer 2010, Applied with Service Pack 1 update has Nuget Package Manager – Siva Karthikeyan Mar 01 '13 at 06:21
  • The bummer part is that if you have an old laptop that you cannot upgrade to Win7/8, you cannot get VS2012 express. So not being able to use Nuget in VS2010 C# express is a real drag. Of course we can use the Web Dev version but what if you want to write command line apps (and leverage NuGet packages)? – Philippe Monnet Jun 05 '13 at 13:02
  • I have added one on the codeplex site https://nuget.codeplex.com/workitem/3962 because nuget does not work for vs2010 express for windows phone – JP Hellemons Jan 16 '14 at 08:07
45

If you have VWD Express installed you can work around this as follows:

  1. Save and close your project in c# Express

  2. Open the project in VWD Express and use Nuget from there to add your packages

  3. Save your project and go back to c# Express

David
  • 1,519
  • 11
  • 11
  • This is a really quick solution. Thanks David. – Kevin Rood Nov 29 '11 at 04:49
  • 3
    This *would* be quick if installing and registering Visual Studio 2012 for Windows Desktop wasn't such an unbearably slow and awkward process. But in the end it did work -- thank-you. – yoyo Dec 04 '12 at 18:45
  • Yes, as @yoyo has said, it's a real pain. Also installing Visual Studio 2012 tends to break older installations (like disappearing icons on vs2010 pro) - Thanks M$ (not)... – Barton Feb 12 '14 at 00:26
11

To install a package in visual studio c# express 2010 use the command line tool nuget.exe. Download nuget.exe from the nuget website add the path to the executable to the windows path environment variable, cd to a place you want you library to be then run it with the library name as an argument.

C:\Code\myprojectdir\myproject>nuget install CommandLineParser
Installing 'CommandLineParser 1.9.71'.
Successfully installed 'CommandLineParser 1.9.71'.

Then just add a reference to the appropriate version of the dll (ie 4.0), in visual studio c# 2010 using project->add reference->browse. Then build the project.

Scott Mermelstein
  • 15,174
  • 4
  • 48
  • 76
ejectamenta
  • 1,047
  • 17
  • 20
0

Visit this video: https://youtu.be/8DcANVHLE0o The way is: Download .exe file from nuget.org, and make a folder in %appdata% "NuGet", paste the exe file in the folder, after that open cmd, type cd (the folder adress), and type nuget install (package), the go in the package folder, lib, copy the dll file, and put it as Reference in visual basic