Search code examples
c#.netdllsolutionmulti-project

Better to reference a DLL or have multi-project solutions?


I'm still learning .NET (specifically C#), and I'm curious as the advantages of creating and referencing a dll versus having a multi-project solution? I have the opportunity to do either one, but I'm not sure which would be better. The projects that would be dlls are rather small, but will potentially be reused. Should size and reusability be a factor when making this decision? Thanks for any and all help.


Solution

  • You're still technically referencing other assemblies as each project generates an assembly.

    One benefit of having a multi-project solution is that you don't need to build two different solutions- if you change code in both projects the whole solutions builds in one step. Also you can debug both projects at the same time (which is possible with separate solutions, but trickier).

    Size may be a factor in build times, but unless they are huge it shouldn't be a huge issue. If projects are used by other solutions it may make sense to keep them in separate solutions so you can control the build process better.

    Having separate solutions can also help you keep the interfaces constant since it's moderately harder to change interfaces through the whole stack.