There's no "Disable NuGet Package Restore" option


If I want to disable the NuGet Package Restore option, there's no way to do it other than going through each project file and removing the appropriate entries (or was I not looking good enough?). This can be bothersome if there are a lot of projects in the solution.
Closed Aug 17, 2014 at 4:41 PM by JeffHandley
We're not going to implement this. We'd have to get into full MSBuild parsing to ensure it's all cleanly removed and there are too many edge cases where we wouldn't be able to fully remove it.

We've documented the mainline cases and there are community tools to do the work in many cases.

Additionally, this feature would have a short life since we've now removed the menu option for enabling package restore; the investment needed here isn't worth the short life of the feature.


dotnetjunky wrote Jan 31, 2012 at 5:53 PM

Can you explain a bit more why you want to disable?

Ph03n1X wrote Feb 3, 2012 at 12:01 PM

You can disable package restore by opening the Package Manager Console and running the "Disable-PackageRestore" command. If don't specify the target project, it'll disable package restore for all the projects in the solution.

JeffHandley wrote Mar 16, 2012 at 8:05 PM

The disable-packagerestore command is from the power tools, and not part of NuGet, so there's chance that enabling package restore through NuGet and disabling through the power tools would have unexpected results.

We will continue to consider providing a built-in way to disable package restore.

tommck wrote May 17, 2012 at 12:48 PM

I'm disabling package restore because it's causing incredible slow-down of my solution load w/ TFS. See my "Connect" issue here: https://connect.microsoft.com/VisualStudio/feedback/details/736025/stuck-at-preparing-solution-for-a-long-time#tabs

pranavkm wrote May 17, 2012 at 5:30 PM

@tommck, could you give us the log after you try out these steps:

1) Close VS. Delete the packages directory.
2) From the command prompt, run msbuild /v:D <Solution>.sln > MsBuild.log
3) Attach msbuild.log to this work item

Vaccano wrote Aug 17, 2012 at 9:51 PM

I love package restore for my auto build or when my coworkers add a new project.

But I have 48 projects in my solution. That makes Package Restore a "Slow Down" for my normal debugging builds.

It would be nice is there was an easy way to toggle it on and off...

tunurgitr wrote Dec 14, 2012 at 4:08 AM

I'm also suffering serious performance issues with package restore enabled in a solution with lots of projects. I really just want to turn it off during normal builds. Even an ability to add/create a solution/project configuration that would disable package restore would be great.

ploeh wrote Feb 27, 2013 at 9:31 AM

Since the product owner keeps asking why anyone would want to disable package restore, here's a couple of reasons.

I love NuGet, but find that the Package Restore option is a source of a lot of problems. First of all, I think it solves a problem that's not really a problem: so what if we check in binaries in source control? Disk space is cheap these days.

Package Restore solves a problem that's not really a problem, but adds a lot of additional complexity:
  • What happens if you're offline? You may ask how often anyone would be offline in 2013, but it really depends on your lifestyle. I do all of my coding on an ultrabook and travel regularly, so offline coding is a very real scenario for me.
  • What happens when you use private repositories? You can set up NuGet to use other package sources than nuget.org, but if you do that and then find yourself in a situation where you can no longer 'see' the custom package source (e.g. it's behind a firewall), once again, you'll have problems.
I find that checking in all binaries in a DVCS (Git or Hg) is a much simpler and more robust way to work. So, it uses a few more megabytes on everyone's disk - and so what?

In the end, I'm not saying that Package Restore is useless - I'm sure someone can come up with good scenarios. I'm only saying that there are also plenty of scenarios where Package Restore is in the way.

dotnetjunky wrote Feb 27, 2013 at 8:59 PM

Hi ploeh,

Currently, package restore is off by default. If you never enable it, then you don't have to disable it. Did you ever enable it?

ploeh wrote Feb 27, 2013 at 9:46 PM

@dotnetjunky I know it works like that, so I never enable it myself. However, in a team environment, someone else who doesn't know better might enable it.

jellysandwich wrote Dec 16, 2013 at 9:07 PM

Please create a disable option.

Also the Nuget GUI needs some serious upgrades.
  • 1. Its not intuitive,
  • 1. Its hard to manage the package
  • 1. Its hard to turn off restore
  • 1. Downloads unneeded packages
  • 1. Sometimes its not able to restore pacakges

roncain wrote Feb 24, 2014 at 7:32 PM

Until this feature is implemented (+1 to fixing this), some people have found these links useful:

How to disable NuGet package restore

Download app to disable NuGet package restore