Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet - repositories.config

Tags:

nuget

NuGet newbie question-
I saw repositories.config being added in NuGet packages folder.
Can anyone please guide me what is the purpose of this file?

Thank you!

like image 335
inutan Avatar asked Sep 02 '11 16:09

inutan


People also ask

Where is NuGet packages config?

If you right click the project in question you can select "Manage nuGet Packages" from the menu. After you do that you can click "installed packages" on the left hand side to see the packages that you currently have installed. These are what you are seeing in your "packages. config" file.

What are NuGet repositories?

NuGet provides the central nuget.org repository with support for private hosting. NuGet provides the tools developers need for creating, publishing, and consuming packages.

Where is package config file located?

By default, pkg-config looks in the directory prefix/lib/pkgconfig for these files; it will also look in the colon-separated (on Windows, semicolon-separated) list of directories specified by the PKG_CONFIG_PATH environment variable.


2 Answers

It's a file that's mostly a NuGet implementation detail, and should not be dealt with directly (it may go away or change in the future).

But for reference, it contains a list of paths that point to all the packages.config in the solution. Typically there is one per project that uses NuGet.

like image 90
David Ebbo Avatar answered Oct 14 '22 00:10

David Ebbo


David Ebbo's answer is from 2011, and the official advice keeps changing between versions.

Here's where we stand in 2015, for NuGet 2.7+ with the 'Automatic Package Restore' (recommended) workflow

I'm paraphrasing, but basically the advice is:

Remove packages/repositories.config from source control. We'll re-generate it anyway.

...unless it somehow breaks on your machine. Then do add it to source control.

This hint comes from the section on ignoring files in git:

# Ignore NuGet Packages *.nupkg # Ignore the packages folder **/packages/* 

And the important part:

[...]

# Uncomment if necessary however generally it will be regenerated when needed #!**/packages/repositories.config 
like image 43
Cristian Diaconescu Avatar answered Oct 13 '22 23:10

Cristian Diaconescu