.NET Library that can be used in ASP.NET Core 1.0, Mono

111 Views Asked by At

.NET Framework DLL or another library that works across .NET Framework >=4.5, ASP .NET Core 1.1 and Latest version of MONO Framework(on RHEL)

I inherited 3 different projects that I want to merge and maintain a simpler source code structure. These 3 projects were developed by 3 different teams that left the company. One is a Windows Forms(.NET Framework 4.5) project, another one is an ASP.NET Core 1.0(with a WebApi and a Web Application) and a Windows Service(.NET Framework 4.6 that I am currently running on Linux with Mono installed). There are common code files among these projects and I would like to maintain a single code base for all these projects. The common code would be a bunch of async calls to REST services(for now). The idea is to have this library be shared across Mono(on Linux), .NET Framework and ASP.NET Core. My question is: is it possible to write such library that can be shared across different project types and be cross-platform?

MONO's compatibility website supports async calls(.net 4.5 and upwards) and I have been able to run async call code(developed in .NET Framework 4.6.1 on Windows platform) on RHEL using Mono without any issues/recompilation. I have done some research on .NET framework and core and figured that some incompatibility exists between .NET Framework and ASP.NET Core.

1

There are 1 best solutions below

2
Eriawan Kusumawardhono On BEST ANSWER

Upgrade your ASP.NET Core to be .NET Core 2.1/2.2, set the target of the Winforms to use .NET Core 3.0 Preview 8, because .NET Core 3.0 supports Winforms.

And then target your library to use for cross platform to have .NET Standard 2.0 as the main target/TFM.