Using the package recovery feature, you can significantly reduce the size of your project by submitting the source code without having to submit the code base to source code control. All NuGet packages are stored in the solution's Packages folder.
To enable package recovery, right-click the solution (Note that the project file is not right-clicked) and select the Enable NuGet package restore option. A series of prompt dialog boxes appear on the screen
We will see a confirmation prompt dialog box.
Once you are sure, start configuring Nuget package management for your solution. After the configuration is complete, there is a hint.
When you are finished, a. NuGet solution folder is added to the solution.
Later, in the solution, when the project needs to add a NuGet package reference, the NuGet Package Manager can be found through the project's right-click menu.
For example, we can add a Redis package to the project.
After the add is complete.
Note that a packages.config file has been added to the project.
Contents of the Packages.config file in the project file
<? XML version= "1.0" encoding= "Utf-8" ?> < Packages > < ID= "Stackexchange.redis" version= "1.0.414 " targetframework= "net45"/></packages>
The actual assembly is saved in the solution's folder.
When you check in your code, you do not need to check the assembly files in packages into code management, which reduces the size of the codebase.
After checking out the code, if we are missing a code base locally, such as JQuery
<?XML version= "1.0" encoding= "Utf-8"?><Packages> < PackageID= "Stackexchange.redis"version= "1.0.414"targetframework= "Net45" /> < PackageID= "JQuery"version= "2.1.3"targetframework= "Net45" /></Packages>
We can manage NuGet packages for the solution in the right-click menu in the solution.
If there is a missing package in our solution, there will be a yellow cue bar on the Open dialog box title. There is a restore on the far right, and when clicked, NuGet will automatically download the corresponding code base to the Packages folder on the local solution.
NuGet Management package dependencies used in the solution