In this article, I will discuss the different deployment types available in .NET Core.

There are two different types of deployments for .NET Core applications:

  • Framework-dependent deployment (FDD)
  • Self-contained deployment (SCD)

Framework-dependent deployment

With the framework-dependent deployment, the application depends upon the .NET Core runtime installed on the target machine on which the application and third-party dependencies are deployed.

By default, when executing the **dotnet publish** command, the .NET Core CLI compiles and configure the application to target a specific version of .NET. It also publishes the resulting set of files using FDD to a directory. That targeted .NET Core runtime is required to be on any machine where your application runs.

$ dotnet publish -f netcoreapp3.1 -c Release

Minor version roll-forward

It’s important to mention that when an application runs from an FDD, the**dotnet** executable is the application’s host. It’s in charge of checking the presence of an acceptable latest patch version on the machine. If no acceptable runtime is installed, the application won’t run.

A few possible scenarios while deploying an application are:

  • Target version specified in the application: 3.0
  • Highest version installed in the target machine: 3.0.3
  • Version used to run the application: 3.0.3
  • Target version specified in the application: 3.0
  • Highest version installed in the target machine: 3.0.3 and no 3.0.* versions are installed
  • Version used to run the application: 3.0.3
  • Target version specified in the application: 3.0.
  • Highest version installed in the target machine: 2.1.1 and no 3.0.* versions are installed
  • Version used to run the application: An error message is displayed
  • Target version specified in the application: 2.0.
  • Highest version installed in the target machine: 3.0.0 and no 2.x versions are installed
  • Version used to run the application: An error message is displayed

Pros

  • The build only contains code and its external dependencies, which reduce its final size.
  • There is no need to worry about the operating system installed on the target machine.
  • As the .NET Core runtime is installed on server, the required disk space and memory cost is reduced.
  • Thanks to the “Minor version roll-forward” mechanism, the FDD automatically applies the latest .NET Core security patch available on the system that runs the application.

Cons

  • The application need the correct version of the .NET Core runtime installed on the target machine.

#dotnet #coding #dotnet-core #microsoft #deployment

.NET Core deployment types
1.70 GEEK