Friday, November 29, 2013

Automating package restore in Visual Studio, don’t keep NuGet Packages in source control

When developers install NuGet packages and set references to those assemblies then it would be necessary to keep them available during build. On the other side down the road maybe the NuGet packages in your projects need to be upgraded and also keeping more and more binaries in repositories will just consume more space in your local disk and in repository especially for Git or Distributed version control systems (DCVS) which include every version of every file within the repository.

The best way is to enable package restore during build, the feature added since NuGet 2.0 and improved as of NuGet 2.7.

By automating package restore in Visual Studio the build events can handle installing the missing packages which eliminate the necessity of keeping them in repository.

There are two levels which should be set, simply go for ToolsOptions and then try to choose Package Manager 1. Visual Studio is configured to 'Allow NuGet to download missing packages' 2. Visual Studio is configured to 'Automatically check for missing packages during build in Visual Studio'



It’s done, but there is other options too like [MSBuild-Integrated Package Restore] which I’ll point to that in next blog entry.

Share/Bookmark

No comments: