NuGet is an excellent visual studio extension and answer to dependency management in .NET. It makes super easy to manage third party libraries. If are working on .NET and have not noticed NuGet, you are missing something very useful, read about NuGet here.
If you have been working on Java platform then this is something similar to Maven dependency management 
In early days… developers used to commit third party libraries (.dlls) into source control, those who don’t tend to get part of GAC. So we have seen developers maintaining folders like Lib, External Libraries etc. as part of repositories or branches into source control. This approach is easy but have it’s own limitation such as version management and manual maintenance etc.
Then comes the NuGet Package Manager to resolve dependencies. It’s has benefit of integration with Visual Studio and manages packages over just libraries (dlls). It creates a “packages” folder to download all external libraries and their dependent libraries along with version management.

NuGet Package Manager
With that developers started committing “packages” folder into source control to share external dependencies across team or contributors and that is fine but over time this would make distributed versioning control systems like Git to grow significantly large due binaries.

Restoring Packages Automatically

With NuGet 2.0, now you don’t need to commit “packages” folder and let NuGet download and restore missing packages when you build solution
For NuGet to do this, you need to take few steps.
1) Check “Allow NuGet to download missing packages during build” in Tools -> Options -> Package Manager
2) Enable NuGet Package Restore
That will do the needful, it would create a nuget folder as part of your solution file and will now automatically restores the missing libraries. What happens is that at the time of build, NuGet reads the packages.config file, identify the missing ones and download the missing packages with mentioned version from NuGet gallery.
This way you don’t have to commit your “packages” file into source control and yet easily maintain dependencies.
Have you tried NuGet Package Manager, dear reader?

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *