Search⌘ K
AI Features

Publishing a Self-Contained App

Explore the process of publishing self-contained .NET applications for multiple platforms. Learn to use command line tools to build, publish, and verify apps for Windows, macOS, and Linux. Understand the folder structure, supporting files, and cross-platform execution to efficiently distribute your .NET projects.

Steps to publish a self-contained app

We have seen some example dotnet tool commands. We can publish our cross-platform console app:

Step 1: At the command line, ensure we are in the DotNetEverywhere folder.

Step 2: Enter a command to build and publish the self-contained release version of the console application for Windows 10, as shown in the following command:

Shell
dotnet publish -c Release -r win10-x64 --self-contained

Step 3: Note that the build engine restores any needed packages, compiles the project source code into an assembly DLL, and creates a publish folder, as shown in the following output:

MSBuild version 17.7.1+971bf70db for .NET
Determining projects to restore...
All projects are up-to-date for restore.
DotNetEverywhere -> /usercode/DotNetEverywhere/bin/Release/net7.0/win10-x64/DotNetEverywhere.dll
DotNetEverywhere -> /usercode/DotNetEverywhere/bin/Release/net7.0/win10-x64/publish/
...