DZone
DevOps Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > DevOps Zone > Pro Tip: Don’t Push Binaries To Source Control, Use NuGet Wisely Instead

Pro Tip: Don’t Push Binaries To Source Control, Use NuGet Wisely Instead

Itamar Syn-hershko user avatar by
Itamar Syn-hershko
·
Apr. 17, 12 · DevOps Zone · Interview
Like (0)
Save
Tweet
5.30K Views

Join the DZone community and get the full member experience.

Join For Free

If you use nuget, then you probably are familiar with the packages folder that takes forever to update in your source control repository. Whenever you or someone in your team updates a package, committing and pushing it takes forever, and then everyone updating their local copies have to wait as well for it to download again.

In most scenarios there is absolutely no need for going through that torture. Instead of pushing binaries to your source control repository, you can just get those packages dynamically when building. Here are the steps to make this happen in an existing solution - it is even easier to do for a new one:

1. Copy Nuget.exe (you can get it from their site) to a \Tools folder under your solution

2. Go to Project -> ProjectName properies -> Build Events and add this pre-build action:

$(ProjectDir)..\Tools\Nuget.exe install $(ProjectDir)packages.config -o $(ProjectDir)..\Packages

3. Save and close VS. Delete the packages folder and commit.

4. Add the packages folder to gitignore. If you are not using git, start using it already.

5. Open the solution again, do a Clean Solution and build, see if nothing breaks. It shouldn't. Now push the change and relax.

Note this methods preserves the package version used, and when someone updates the version number all that is left to do is push a simple change to a text file and that's about it.

Slick.

source control Git NuGet

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Flask vs. Django: Which Python Framework to Choose?
  • No Code Expectations vs Reality
  • Is DataOps the Future of the Modern Data Stack?
  • Troubleshooting HTTP 502 Bad Gateway in AWS EBS

Comments

DevOps Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo