Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet and distributed version control (DVCS)

I wonder if it is possible to use nuget to only store references to the required packages in version control (only the package.config and ignore the packages folder).

Is there a way to tell nuget to (re)download all the referenced packages in the various package.config files? Or something similar which could be put into a build script.

Update:

Seems that I'm not the only one who requested this feature: See this work item (thanks to PHeiberg for the hint)

Update 2:

NuGet now has this feature builtin. See Using NuGet without committing packages to source control for details. All left is to add the packages directory to .gitignore or some equivalent of your VCS (/packages/ will do the trick if you have it in the root of your repository and are using git).

like image 503
Fionn Avatar asked Oct 16 '10 18:10

Fionn


People also ask

What is DVCS in git?

Distributed Version Control System. Git is a distributed version control system (DVCS), or peer-to-peer version control system, as opposed to centralized systems like Subversion. There's no notion of a “master” or “central” repository with Git.

What does DVCS stand for?

A distributed version control system (DVCS) is a type of version control where the complete codebase — including its full version history — is mirrored on every developer's computer. It's abbreviated DVCS. Changes to files are tracked between computers.

Why do we need DVCS?

A distributed version control system (DVCS) brings a local copy of the complete repository to every team member's computer, so they can commit, branch, and merge locally. The server doesn't have to store a physical file for each branch — it just needs the differences between each commit.

Why Git is called as distributed VCS?

It is called distributed because every git working directory contains a full-fledged repository containing complete history of the tree. This also means that you actually do not need network access for development because your tree can essentially be the master tree.


2 Answers

I just found out about NuGetPowerTools: https://github.com/davidfowl/NuGetPowerTools

Also see: http://blog.davidebbo.com/2011/08/easy-way-to-set-up-nuget-to-restore.html

Update: NuGet 1.6 now supports Package Restore: http://docs.nuget.org/docs/release-notes/nuget-1.6

like image 98
Robert Ros Avatar answered Sep 21 '22 08:09

Robert Ros


I don't know about your first question.

As for having a CI server automatically update the packages, it's doable in theory. You could chain the "List-Package -Installed" and the "Update-Package" commands and have each package updated to the latest version. See the command reference for further details.

Scott Guthrie says this on the topic:

"You can integrate the command-line option with a CI solution and do an update-package command explicitly as part of your build/CI process to pull down updates. Frankly I'm not sure that makes sense for the scenarios we are talking about, though, as typically you want some dev to decide before updating a core runtime dependency to a new version. NuPack's default model would have a developer use NuPack to install a library - and NuPack would automatically check in the package and dependencies to source control. That way another dev (or the CI server) wouldn't need to use NuPack again - they could just sync their source and build. But as I mentioned earlier - if you wanted to explicitly do an update as part of your CI process you could."

Edit:

After your comment I see what you're trying to achieve. I found this long thread in the NuPack discussions list about the issue. A solution will apparently not be part of v1. A custom build task in the CI of your choice and a config in your repo for it is the only solution I see. Please report back with your findings. You got me interested.

like image 32
PHeiberg Avatar answered Sep 17 '22 08:09

PHeiberg