I have an existing codebase written in .Net 4.5.x. I'm trying to create some new .Net Core services with the aim of eventually migrating the codebase to .Net Core piecemeal. I'd like the option to (eventually) deploy these services to small Linux servers, so I've targeted the first of them at .Net Core rather than the .Net Framework.
All of the existing code should communicate with the new services via standard REST endpoints. Since it's all REST, all that will actually go over the wire is JSON. No problems there.
I'm hoping to avoid some code reuse by having some shared Model projects which both the legacy and new services can utilize. I know this would be possible if the new services were .Net Core projects targeted at the .Net Framework, but I'm hoping there's a way to have a middle layer support legacy .Net Framework code and new .Net Core targeted code.
Is this possible, or is my only option to have the DTO classes duplicated in two projects until everything can eventually be ported over? Alternatively, am I architecting this all wrong in the first place and should I actively want dto classes on both ends?