ASP.NET Core Interview Question #209

What is application publishing in ASP.NET Core?

Testing, Deployment & Hosting Senior Advanced

Quick Interview Answer

Publishing prepares an ASP.NET Core application for deployment. The publish process compiles the application and produces the assemblies, configuration files, static assets, runtime metadata, and other files required by the chosen deployment model.

Detailed Explanation

Publishing prepares an ASP.NET Core application for deployment. The publish process compiles the application and produces the assemblies, configuration files, static assets, runtime metadata, and other files required by the chosen deployment model.

Publishing can be performed with Visual Studio, the dotnet CLI, or a CI/CD pipeline. The exact output depends on settings such as framework-dependent versus self-contained deployment and target runtime.

Publishing is different from deploying: publishing creates deployable output, while deployment transfers and activates that output in the target environment.

Code Example

dotnet publish -c Release -o ./publish