Location of Packages.config

Nov 28, 2010 at 4:50 AM

I don't know if I'm just missing something or what, but is there some way to have one packages.config file per solution? Ideally I'd like to locate it in the packages directory itself.

Developer
Nov 28, 2010 at 8:15 PM

The packages.config file is in the project because we need to know what packages are installed per project as well as per solution. For the solution, we use the package file itself to keep track of what is installed. 

Nov 29, 2010 at 12:03 AM

That works as a reason for having the per-project packages.config, but I'm a little unclear about you mean by "package file itself." Can you clarify?

Nov 29, 2010 at 12:05 AM

Also, if it helps, the reason is because I'd like to see, e.g., Castle.Core available out of the list of local packages for every project in the whole solution once it's been added to any of them. You get this behavior where it's least useful, only within the context of a single project. That is why I was asking about having a single one, so it would serve more as an index of what's available than of what's installed. I think NuGet needs both.

Developer
Nov 29, 2010 at 3:47 AM

Local Packages are local to a solution not a the machine. When you install a nuget package into a project, it installs it to the solution first then it gets extracted into the project. e.g.:

packages/
     Castle.Core.1.2.0/
       Castle.Core.1.2.0.nupkg
       lib/
          Castle.Core.dll
 
MyProject/
    packages.config

In the above example, that packages folder is stored at the solution level. The packages.config file, points to packages installed within the current solution.

I hope that clears things up.

Nov 29, 2010 at 7:39 AM
Edited Nov 29, 2010 at 7:46 AM

I understand now. I think I may have confused the issue a little
because ultimately it seems it's not really about packages.config.

The Add Library Reference dialog should probably populate its local
packages list based off of the contents of the packages directory
rather than that project's packages.config, which it seems to do. Am I
missing a way to do this now or is this something I should file a
feature request against?

Developer
Nov 29, 2010 at 12:40 PM

I'm not sure what your feature request is for. When you open the Add Library Reference dialog, the list of Installed Packages comes from packages.config within that specific project, not the entire solution. 

Coordinator
Nov 29, 2010 at 3:46 PM

I think I understand.

We can’t change the list of “Installed” packages to include Castle.Core just because it’s installed in one of the local projects. Otherwise, how would you ever install it in another project within the same solution?


However, we could have another node that lists all packages in the solution. Would you find that more useful than a “Recent Packages” node or a “Favorite Packages” node?

Coordinator
Nov 29, 2010 at 4:00 PM

BTW, in the meanwhile, if you open the Package Manager Console and type:

List-Package

That will show you all the packages installed in your solution.

Nov 29, 2010 at 4:50 PM
Edited Nov 29, 2010 at 4:51 PM

This is exactly what I mean. I don't care if it's a separate node, but
it would be nice if that selection is stateful between instances of
the dialog.

I think the combination of All Packages in My Solution with custom
feed sources will be a nice win for big projects, particularly once
someone writes an msbuild plugin to automatically generate the package
files, if it hasn't been done already.