I'm hoping someone on the core team can answer this one. I'm hacking around in the code writing a patch for the following work item:
- [workitem:allow meta packages (no files, only dependencies)|180]
It has gotten a few votes and I _thought_ that it would be a fairly quick fix just to get my feet wet as a contributor. I've pretty much identified what I would need to do to make it work but it has left me with more questions than answers, so before
I go and create a fork and implement the patch I wanted to ask some questions for clarification about the general design of the code-base.
If you take a look at the "InstallPackageCmdlet" class in NuPack.VisualStudio you can see the the "ProcessRecordCore" method which is part of the PowerShell plumbing. Within that method a boolean flag is set called "isSolutionLevelPackage".
The implementation of the code that sets this flag basically determines that a solution level package is any package that doesn't contain content (i.e. no \lib folder). Based on this flag the code calls "InstallPackage" on a "PackageManager"
instance (solution level packages), or "AddPackageReference" on a "ProjectManager" instance (normal packages).
The InstallPackage routine ultimately ends up just unpacking the files, whereas the AddPackageReference unpacks the files and adds assembly references to the projects.
From an API point of view I think having AddPackageReference and InstallPackage really should be rolled in together (or one is called downstream from the other.
I think that there should really only be one entry point into the package management space from the Cmdlet (from a good abstraction point of view) and I also think that it isn't the Cmdlet's job to make the decision about what is a solution package
and how it treats it. The fact that a solution package is defined as one that has no content will ultimately make it difficult to define meta packages.
The <dependency />attribute may also need to be modified to define how you want that dependency to be handled, for example:
<dependency installBehaviour="addReference|install" />