Code Sharing in .NET Core

Code Sharing in .NET Core

With .NET Core, we can currently develop applications with three different .NET frameworks for different platforms. The traditional or standard .NET Framework is for Windows, Mono framework for iOS, OSx, and Android, and .NET Core for Windows, Mac, and Linux.

No alt text provided for this image

These frameworks use different framework class libraries. It means code written in one framework cannot be used with other frameworks. For example, a console application developed with .NET Framework cannot run on .NET Core or vice-versa. Thus, code-sharing is not allowed.

It would be nice to write code once and share it with other applications with different .NET frameworks. Isn't it?

No alt text provided for this image

To solve this problem of code sharing, we can use the following three approaches:

  1. Create Portable Class Library
  2. Target Multiple Frameworks ASP.NET Core app
  3. Target .NET Standard


To view or add a comment, sign in

More articles by Sardar Mudassar Ali Khan

Insights from the community

Others also viewed

Explore topics