Honestly, I don't see what the problem is.  

Refactor your duplicate code into functions that are applicable generically, and put them into their own libraries or frameworks.  Make them loosely-coupled and architecture-agnostic, and you should never have any problem.  If you need inspiration, study how the .NET framework abstracts concepts using things like interfaces, generics, and software patterns such as `Dispose()`.

Also, remember that not all duplicate code is really duplicated; some of it is glue code or code that is otherwise necessary for sustaining the architecture, so don't obsess over being too DRY.