Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create nuget package for a solution with multiple projects

Tags:

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?

like image 590
Charles Ouellet Avatar asked Sep 02 '11 12:09

Charles Ouellet


People also ask

How do I add a NuGet package to multiple projects?

Right-click your solution > Manage NuGet Packages for Solution... ... Or: Tools > Library Package Manager > Manage NuGet Packages for Solution... And if you go to the Installed packages area you can 'Manage' a single package across every project in the solution.

What does a Nuspec file do?

A . nuspec file is an XML manifest that contains package metadata. This manifest is used both to build the package and to provide information to consumers. The manifest is always included in a package.


1 Answers

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).

like image 64
Cristian Diaconescu Avatar answered Oct 05 '22 06:10

Cristian Diaconescu