قالب وردپرس درنا توس
Home / Tips and Tricks / What is the difference between .NET Framework and .NET Core? – CloudSavvy IT

What is the difference between .NET Framework and .NET Core? – CloudSavvy IT



Microsoft .NET

Microsoft provides two different .NET runtimes: .NET Framework and .NET Core. Both implement the .NET standard and the code between each is quite cross-compatible, but the .NET Framework only works on Windows. We discuss the differences between the two driving times.

The short answer: Compatibility between different platforms

The quick answer is that .NET Core runs on Linux and macOS, while the .NET Framework only runs on Windows. You use the .NET Core when you need platform compatibility and you use the .NET Framework when you need Windows-specific services and NuGet packages that have not been ported to. NET Core.

.NET Core is the successor to the .NET Framework, so it̵

7;s definitely what you want to choose in the future. It leaves some Windows-only features, but many of these can still be supported with the Windows Compatibility Pack extension.

Overall, Core and Framework are about the same, but in practice they have some small differences. Both .NET Core and .NET Framework use the same API, called .NET Standard, but Core is open source, while Framework is Microsoft’s only Windows implementation.

In general, Core is a bit lighter than Framework, as it is designed for and typically used with Docker in microservice-based backends. In addition to being able to use Linux in the first place (necessary for Docker), the resulting image will be a little smaller with .NET Core.

In addition, most of the differences are in NuGet package differences. For example, Entity Framework Core is a little different from Entity Framework 6, which runs on the .NET Framework. ASP.NET Core is very different from ASP.NET 4, as they have redesigned much of it for .NET Core.

When to use .NET Core

You should use the .NET Core over the .NET Framework when:

  • You requires platform compatibility. This includes the use of Docker and microservice architectures.
  • You start a new project and only need to choose one. (.NET Core is newer.)
  • You do not use Windows-specific tools, libraries, or NuGet packages that depend on the .NET Framework.
  • You want the best possible performance. Microsoft recommends .NET Core with ASP.NET over the .NET Framework.
  • You want to run multiple versions of .NET Core together. Framework does not support this.
  • You want CLI access on Linux or run your CI / CD build server on Linux.

When to use the .NET Framework

You should use the .NET Framework over the .NET Core when:

  • You only target Windows distributions.
  • You use heavy Windows packages and libraries, such as Windows Forms, WPF, ASP.NET Web Forms / Pages, and Windows Workflow Foundation.
  • The technologies you use are not added by the Windows Compatibility Pack for .NET Core.
  • You are already using it and migration would be too much.

How to switch to .NET Core

Usually this is “how to switch from Framework -> Core”, as all existing working projects on .NET Core probably do not need to switch back to the older .NET Framework.

If you use something Windows-specific, you can not. You are stuck in the .NET Framework until the components you use get Core versions and for some things that will not happen as with ASP.NET WebForms.

The simplest solution would be to create a new solution and project based on .NET Core and transfer your code over. If you have a simple app, this is probably the easiest solution.

Otherwise you can use dotnet try-convertor follow the Microsoft Porting Guide.

For large complex projects, you can use the .NET Portability Analyzer. This is a tool from Microsoft that scans your project, tells you how difficult a conversion can be and shows you what your next steps should be. It can also create a targeted graph of your addictions, which can help you see what you need to analyze. Some projects will be more difficult to port than others, and if you use something that is not available in Core, you may not be able to port at all without a solution.


Source link