Firsts NuGet doubts

Topics: General
Nov 7, 2012 at 2:17 PM

Hello all, im starting to use this (great) tool and have som first doubts i want to ask:

1) I have a local (network) repository for the common developers to use, it has some limited amount of packages, what is the best way for sync these only packages with their latest version from central repository ?

2) I also have libraries of my own that i need to put in the local repository, currently i have installed for the solution the NuGet.CommandLine and used "nuget spec" and "nuget pack" commands to generate the package, is this the best way to do it ?

3) Have tried the "Enable NuGet Package Restore" option for the solution, hwo do i undo this or "Disable NuGetPackage Restore" ? 

Im sure next im going to ask some things about integration with TFS build...


Nov 7, 2012 at 7:17 PM



1. You can have a packages.Config file which lists all the packages you are interested in. You can install the packages from the central repository to your local share using Nuget.exe install packages.config command. Also check out details about versioning constraints that could be added while updating.

2. Having Nuget spec and pack command in post build sounds fine.

3. There is no first class "Disable NugetPackage Restore" option available at the solution level. However, you can disable package restore at the machine wide using the package manager settings or by setting an environment variable "EnableNugetPackageRestore" to "false". To disable just at sln level, you would have to manually delete the .nuget folder from the Solution and the file system.

Nov 8, 2012 at 1:39 PM

1 & 2 ok!

About 3, if i want to do this at solution level (think im using a TFS Build Server for 40 developers i dont want to disable it for all), its enough deleting this folder ? i read something that what the option does is to add a msbuild target, this changes the .csproj file ? dont i need to edit the .csproj file too or something else ?

Many thanks!


Nov 8, 2012 at 3:45 PM

Thats true. To do a clean rollback, you shall undo the changes in csproj. But since the targets are imported from the .nuget folder, just deleting that folder makes the changes in csproj as a no-op.

Nov 8, 2012 at 3:56 PM

Actually, deleting the .nuget folder without undoing the changes in csproj will result in a build break because the .target file is missing. You still need to remove the import statement from the project files.