I am working on a set of .NET Core 2.0 Microservices together with some other developers. I wrote some code to add my own custom logging as described here. My logger sends the logging messages to an external cloud based log system (so not the command line). I am now trying to find out where my code should be placed. The logging is needed for all Microservices.
One option is a library. This library can be called from all Microservices. This seems an obvious solution. The library needs to be compiled once and can be used everywhere.
Another option is a shared project. It is compiled as part of each project. This may seem a less obvious solution. The code needs to be compiled as part of each Microservice all the time. However, I see some obvious advantages of this solution:
- A shared project has no references. Therefore the used references can not cause a version conflict with used references inside Microservices. They do not exist.
- A shared project can also (well is likely to) be compiled as part of a future .NET Core version. The shared project does not have a .NET Core version itself so a wrong choice can not be made.
How should I make the choice and what it is the best solution for being future proof?