`dotnet publish` prepares an ASP.NET Core application for deployment. Unlike `dotnet run`, which uses files in the project directory, it builds the app and places its DLL, dependencies, and files such as `wwwroot` in a publish folder. Copy that folder to the target environment. section 27.1.1 section 27.5
dotnet publish --output publish --configuration Release
Run this command from the project directory. `--output` names the destination folder; `--configuration Release` produces optimized output for deployment. section 27.1.1
Run the published app
After publishing, open the output folder and run `dotnet ExampleApp.dll`. Do not use `dotnet run` there: that command expects a project. A published app does not need the .NET CLI to run, though a runtime-dependent deployment needs the appropriate .NET Runtime on the server. section 27.1.1 section 27.3.1 section 27.5
Publishing is one step in deployment; the destination still needs appropriate hosting setup:
- For IIS, keep the generated `web.config` with the published files. If the project already contains one, publishing copies it instead. Let the CLI generate it unless customization is needed. section 27.2.2
- For Linux, copy the output to the server, then configure how the app receives traffic and stays running. A reverse proxy and a separate process manager are common choices. section 27.3.1

