Cover image for Deployments Modes in ASP.NET Core 3.1

Deployments Modes in ASP.NET Core 3.1

sumitkharche profile image Sumit Kharche Originally published at c-sharpcorner.com ・5 min read

This article is originally published here.

In this article, we will be discussing the different deployment modes in .NET Core 3.1. Once we develop any application we have to deploy it somewhere and to do this we have to create a build of our app. So .NET Core provides 3 different types of deployment modes for accomplishing this task.

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

So in this article, we are going to discuss the above deployment modes one by one and also see how to publish the app using the above modes.

Framework-dependent deployment (FDD)

As the name specifies, in case of framework-dependent deployment mode application is completely dependent upon the .NET Core installed on the target machine where you want to deploy your app. Framework-dependent deployment (FDD) is the default deployment mode in .NET Core app. The application only contains the app-specific code and external dependencies. As the .NET Core needs to be already installed on the server your build size also becomes small. You can share the same .NET Core runtime along with multiple application. The .dll will be running with the help of a utility called dotnet.

Benefits of Framework-dependent deployment (FDD)

  • The app will only contain code and its external dependencies. So it will also reduce the final build size.
  • This mode uses the same .NET Core install on server, so it will also reduce the disk space and memory cost.

Self-contained deployment (SCD)

As the name specifies, Self-contained deployment (SCD) does not use the common .NET Core install on the server. The final application build contains all the app-specific code and its dependencies along with .NET Core libraries and .NET Core runtime. In this mode, it is not necessary to have .NET Core runtime install on the servers.

As .NET Core is cross-platform, we can build our code depending upon the platform we want to run the app. There are 6 different target platforms available:

  • win-x86
  • win-x64
  • osx-x64
  • linux-x64
  • win-arm
  • linux-arm

But in SCD the final build size is larger than FDD because the SCD not only contains the app and its dependencies but also contains .NET Core libraries and .NET Core runtime.

Benefits of Self-contained deployment (SCD)

  • As the app is not using shared the .NET Core runtime, we can deploy multiple apps with different versions of .NET Core.
  • In SCD we will be more confident that our app will be running on a target system since you're providing the of .NET Core Runtime that it will run on in the final build.

Framework-dependent executables (FDE)

This mode is included form .NET Core 2.2. It is exactly same as FDD but this mode produces the executable that can be run on any target machine. In this mode, we are not using dotnet utility to run our app.

Published your ASP.NET Core Web API as FDD

First, we are going to create new ASP.NET Core Web API. So open Visual Studio and Go to File -> New -> Project. Select ASP.NET Core Web Application and click on Next.


Give the proper name to your project and click on Create.


We are creating this app for just learning deployment modes so select API as a template and click on Create button.


Now in this section, we will be focusing on how to publish ASP.NET Core Web API. So right-click on a new project and click on the Publish button.


Now it will ask for target then select Folder.


Now click on 'Advanced..'. Now in this section, we have to decide in which mode need to use while creating a build for our app. So now select Framework-dependent as Deployment mode and Target Runtime as Portable & click on Save button.


Now click on the Create Profile button. So this will create a new profile for us which we can use for next time to publish our app.


Finally, click on the Publish button to publish your app in FDD mode.


Open the folder which contains the final published app and you will see it only contains app-specific .dlls bcoz we selected deployment mode as FDD and its size is also small (292 KB).


You can deploy the application using Dotnet CLI as well. So open your developer tool at your project path and run the below command to publish your app in FDD mode.

dotnet publish -c Release

So this way we can publish our app with FDD mode.

Published your ASP.NET Core Web API as SCD

Now in the previous section, we have published our app using FDD mode. Now we are going to publish the same app using SCD and you will see the difference with the output and size of the published folder.

Again click on the solution and select Publish option. As we have already created a profile so you can edit existing profile or you can create a new one as well. We will edit an existing profile.



Now select Target Runtime as per your preference. After that Save the profile and click the publish button. Final build folder contains our app .dlls along with .net core runtime, but the build size is large (85.3 MB).


You can deploy the application using Dotnet CLI. So open your developer tool at your project path and use below command to publish your in SCD mode.

dotnet publish -c Release -r <RID> --self-contained true

So here -r specifies target runtime and is the Runtime Identifier like win-x86,win-x64, etc.


In this article, I have explained about the different modes of deployment provided by .NET Core. Also, demonstrate how to publish the ASP.NET Core Web API using FDD & SCD deployment modes.

I really hope that you enjoyed this article, and please do not hesitate to send me your thoughts or comments.

Happy Coding!

Posted on Feb 4 by:

sumitkharche profile

Sumit Kharche


I am Full stack developer from Pune, India. C# Corner MVP


markdown guide

There is also assembly trimming supported but I have never succeeded on making it work with ASP.NET Core applications. With console ones it works like charm and produces ~2x smaller executable.