Repository per branch

Topics: General
Oct 11, 2012 at 1:18 PM

Hi

I'm kind of new to NuGet and I've been exploring NuGet capabilities for a few days now.

I have multiple branches for my projects (dev and prod).

Is there a way to setup NuGet in a way that all the projects in the dev branch will use one repository and all projects under the prod branch will use another ?

What i want to do is to call Update-Package as a Pre-Build event but if the project is under the dev branch it will ignore the packages that are under the prod branch.

Thanks

Oct 12, 2012 at 6:56 PM

FWIW, I'm trying to work through a similar thing.  The only difference on my part is that instead of run update-package in a pre-build event I'm just trying to have package restore working.  I feel like I'm close, and have posed my last hangup on StackOverflow:

http://stackoverflow.com/questions/12864330/nuget-repository-per-branch-with-tfs

The approach I'm using thus far can be summed up as follows:

  • Put a single nuget.exe and nuget.targets file at the root of my branch
  • The nuget.targets file is configured to point to the repository for that branch
  • Instead of importing a nuget.targets local to each solution in my Team Project from all csproj files, I import the single nuget.targets file at the root of my branch.

Where I'm hung up is on getting that targets file to be different in each branch without causing problems with merges. etc.