VS2010 Update Nuget package to a specific version, but also update dll References in projects

For example my solution uses Nuget package "foo" with version "1.2.30". I want to Update "foo" package for all my solution projects to version "1.2.25", for example. I can't do it through Visual Studio Nuget addon, because if I right click on solution -> Manage packages -> Updates, Nuget won't propose me to update to the version that I want. Nuget will propose only the latest version.

So, I'm using workaround like this:

  1. Manually change "packages.config" files for all projects that use this package from "1.2.30" to "1.2.25" package version.
  2. Right click on solution and Restore packages (Nuget will download "foo" v1.2.25).
  3. After that I need to update References in all projects that use this package, because they still reference "1.2.30". So I open every project "References", Remove the "foo" dll reference(v1.2.30) and then click Add and add dll reference "foo"(v1.2.25).

Questions:

  1. Nuget VS2010 addon is so awesome, why doesn't it have "update to specific version" option in Visual Studio 2010?
  2. Is there any other easier steps to do what I want ?

Thanks a lot, that's really bugging me.

==========ANSWER:==========

You can use Package Manager Console(Tools -> Nuget Package Manager -> Package Manager Console) in Visual Studio to command Nuget what to do via console. It is much more flexible than "Manage Nuget packages".

Examples: Update package "foo" only for project "MyProject":

Update-Package -Id foo -Version 1.2.25 -ProjectName MyProject -IncludePrerelease

Update package "foo" for all projects in solution:

Update-Package -Id foo -Version 1.2.25 -IncludePrerelease

Full help can be found here:

http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference

Answers


You should be able to do this from the Package Manager Console. The following should update all NUnit NuGet packages to version 2.6.1 which is not the latest version.

Update-Package NUnit -version 2.6.1

Need Your Help

Microsoft Chart Controls: Label multiple y values and variable y axis?

c# charts mschart

I am currently using Microsoft Chart Controls to generate a box plot chart. I have enabled the IsValueShownAsLabel property of the chart's series, but only the first y-value(lower whisker) value is

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.