Search code examples
c#.netdependenciesnugetnuget-package

Create nuget package for a solution with multiple projects


We are currently building a solution with several projects.

We have something like this:

- Common
  - Logging
     - Logging.NLog
- Threading

So Logging.NLog is dependant on Logging, Logging on Common...etc.

When we pack Logging.NLog I would like nuget to discover the Loggin and Common dependecies.

At the moment, I created a package with Common, then in Logging I installed the package Common with

install-package Common

But whenever I do a modification to Common, I have to update the package and they are created by our continous integration systeme (Hudson), so it is pretty annoying when we are developing.

I would like to simply have a Project Reference (Add References -> Project...) and the nuget discover the depencies anyway.

Is there a way to achieve it?


Solution

  • There is a planned feature targeting this exact scenario.

    This is how it will apparently look like:

    > nuget.exe pack proj.csproj -IncludeReferencedProjects
    

    It has apparently been implemented mere days ago, but there are bugs still being ironed out.

    The feature, as it currently stands, allows:

    • packaging several projects' artifacts into a single nuget package (by walking project references recursively),

    OR

    • creating nuget package references to those projects's associated packages, if the referenced projects have accompanying .nuspec files.

    The feature request dates back all the way to 1.5, but it kept slipping. Recently though, it gathered enough mass (requests) to be scheduled for release in Nuget 2.3.

    The release plan pegs version 2.3 for "End of April, 2013" so stay tuned.
    (Presently, the latest Nuget version is 2.2.1).