Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commiting libraries added via NuGet

I have a Visual Studio project which I have committed to VisualSVN (via the VisualSVN => Commit menu in Visual Studio). I have added a number of libraries to this project via NuGet.

My colleague has downloaded the project I have uploaded to SVN (via VisualSVN => Get solution from Subversion...) and has found that these libraries are missing, and he is having to re-download them.

A few questions:

  1. Is this by design? Or have I not committed my Solution properly? Or has my colleague not download the solution to his machine properly?
  2. If this is by design, what is the correct way to re-add references to a solution downloaded from an SVN server? I am worried that I may have added a reference and worked with it, and that it may have been updated since so whenever my colleague re-adds the same reference via NuGet he will get a more up to date version that will be different, and this will break my program. Is this a valid concern?
like image 626
JMK Avatar asked Oct 07 '12 13:10

JMK


People also ask

Should you commit NuGet packages?

NuGet now has the ability for you to re-download the missing packages as a pre-build step, meaning that you only need to commit your packages. config file (and include nuget.exe in a tools folder). Read Using NuGet Without Committing Packages to Source Control for more details.

How do I add a NuGet package to Visual Studio?

NuGet Package ManagerSelect Project > Manage NuGet Packages. In the NuGet Package Manager page, choose nuget.org as the Package source. From the Browse tab, search for Newtonsoft.Json, select Newtonsoft.Json in the list, and then select Install. If you're prompted to verify the installation, select OK.

How do I debug a NuGet DLL?

In order to debug into NuGet package libraries, Visual Studio must be configured to use ProGet as a symbol server. To do this select Debug > Options, from the menu bar, then browse to Debugging > Symbols in the tree menu.

Can I delete .NuGet folder?

Yes, the . nuget folder is used as a cache for packages downloaded to speed up project restore and compilation. It can safely be removed.


1 Answers

Yes, this is by design. The whole concept of using Nuget is that you will not have to keep libraries in your version control system.

You need to Right Click on your solution in Visual Studio and select Enable NuGet Package Restore.

This will configure the solution to restore the NuGet packages (if any missing, or in case of none) whenever you'll do a build. Also, all the libraries that you've added for a particular project will have an entry in the packages.config created in the project's source drectory; for eg:

<packages>
  <package id="jQuery" version="1.8.3" />
</packages>

This way NuGet makes sure everybody gets the same version.

like image 114
Arpit Avatar answered Sep 30 '22 09:09

Arpit