liveBook · Manning

Self-contained deployment

As explained in ASP.NET Core in Action, 3e

A self-contained deployment packages an application's required .NET runtime with the application so the target machine does not need .NET installed.

A self-contained deployment (SCD) packages the .NET runtime with an application’s code and libraries, so the target machine does not need .NET installed. section 27.1.1 section 2.4.1

Choose an SCD when deployment isolation matters more than the smallest output:

  • Avoid dependence on the .NET version installed by the hosting machine. section 27.1.1
  • Accept larger deployment files because the complete .NET framework is included. section 27.1.1
  • Compile specifically for the target operating system and architecture instead of deploying the same files everywhere. section 27.1.1 section 2.4.1

Publish for a Windows target

Run `dotnet publish -c Release -r win10-x64 --self-contained -o publish_folder` to create a release deployment for 64-bit Windows. The runtime and application files are placed in the specified output folder. section 27.1.1

dotnet publish -c Release -r win10-x64 --self-contained -o publish_folder

Use the publish command as a starting point for creating a target-specific self-contained deployment. section 27.1.1

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines runtime bundling and contrasts size, portability, and target-specific compilation, without detailing the packaged runtime files.
Examples
Uses a release publish command targeting win10-x64 and writing files to a publish folder.
What it assumes
Assumes a .NET application and distinguishes SDK-based publishing from runtime-based application execution.
What you can do after
Configure a self-contained publish for a specified operating system and architecture.
How it connects
Connects self-contained deployment with runtime-dependent deployment, the .NET runtime, and cross-platform deployment.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.