What is the difference between dotnet build and dotnet publish?
dotnet build compiles your project for the inner development loop and defaults to Debug. dotnet publish runs the MSBuild Publish target, defaults to Release on net8.0 and later, and packages a deployable folder with web assets, self-contained runtimes, single-file, trimming, and AOT handled. Here is exactly what each one produces and when to reach for it.