Create multiple nuget's from a single project

Topics: General
Jan 22, 2015 at 12:31 PM
I originally wrote this on SO, but this might be the correct place:

I wish to publish 3 nuget packages out of my one solution (MyApp.csproj) which contains the following assemblies:
  • MyApp.Core
  • MyApp.Infrastructure
  • MyApp.Infrastructure.UnitTests
  • MyApp.Data
  • MyApp.Web.Mvc
  • MyApp.Web.WebApi
I do not want to include my unit tests project as they will probably be visible for the end-user and not needed for them.

Second, I wish to distrubute my nuget package in the formats:
  • MyApp (MyApp.Core, MyApp.Infrastructure, MyApp.Data)
  • MyApp.Web.Mvc (if the end-user is using mvc)
  • MyApp.Web.WebApi (if the end-user is using this in a web api project)
How do I structure my nuget-spec file to to this?