In our Sitecore 9 solution, we follow Helix principles, when structuring our code and we wish to create NuGet packages that can be re-used across multiple projects. The NuGet packages contains our Sitecore components (Foundation.Dictionary, Feature.PageComponentA, etc).
In a different SO post, I got help as to how I should structure my NuGet package: Creating a custom Sitecore NuGet package containing Unicorn files which means that both C# logic and Unicorn items are in the same NuGet package. So far so good.
However, for NuGet packages that can be used by multiple project (e.g. all NuGet packages made of Foundation.X-projects), we run into some issues. The issues are, that the same Unicorn items + Serialization config will be added to multiple projects in the solution, which quickly clutters up the solution.
Currently, the best solution I see, is to create one NuGet package containing only the C# logic and one NuGet package contanining only the Unicorn items + configuration, for a given feature. For example:
Foundation.Dictionary = C# logic
Foundation.Dictionary.Serialization = Unicorn files + configuration
Then it is possible to install Foundation.Dictionary into all the projects that requires the Dictionary logic and then only add the Foundation.Dictionary.Serialization package once.
The only major disadvantage I see with this approach is, that the consumers of the NuGet packages needs to know, that they might have to install two packages, if a given feature has both C# logic and Sitecore content (templates, renderings etc).
Does anyone have another approach than creating two packages, where both C# logic and Unicorn are in the same package, that does not result in multiple versions of the Unicorn config + Unicorn files?