ASP.NET Core Interview Question #210

What is the difference between framework-dependent and self-contained deployment?

Testing, Deployment & Hosting Senior Advanced

Quick Interview Answer

A framework-dependent deployment relies on a compatible .NET runtime being installed on the target environment. The published application is usually smaller and can use the centrally installed runtime.

Detailed Explanation

A framework-dependent deployment relies on a compatible .NET runtime being installed on the target environment. The published application is usually smaller and can use the centrally installed runtime.

A self-contained deployment includes the required .NET runtime with the application for a specific runtime identifier. It does not require that runtime to be installed separately, but the deployment is larger and runtime updates generally require republishing the application.

The appropriate choice depends on hosting control, deployment size, runtime management, and operational requirements.

Code Example

# Framework-dependent
dotnet publish -c Release

# Self-contained example for 64-bit Windows
dotnet publish -c Release -r win-x64 --self-contained true