There are some significant differences between Build and Publish targeting .NET Framework application vs .NET Core applications:
Building .NET Framework applications will generate the same files as Publish. It will create all the dependencies as binaries including external dependencies (NuGet packages, for instance). So the product of dotnet build is ready to be transferred to another machine to run.
Building .NET Core applications, if the project has third-party dependencies, such as libraries from NuGet, they’re resolved from the NuGet cache and aren’t available with the project’s built output. Therefore the product of dotnet build isn’t ready to be transferred to another machine to run. You need to run Publish to get all 3rd party dependencies as binaries in output folder.
EDIT 10/21/22 —
For Dotnet core projects before 3.0 this is the case after 3.0 third party dependencies are included in the output you can view that here.
The dotnet build command builds the project and its dependencies into a set of binaries. The binaries include the project’s code in Intermediate Language (IL) files with a .dll extension. Depending on the project type and settings, other files may be included, such as:
An executable that can be used to run the application, if the project type is an executable targeting .NET Core 3.0 or later.
Symbol files used for debugging with a .pdb extension.
A .deps.json file, which lists the dependencies of the application or library.
A .runtimeconfig.json file, which specifies the shared runtime and its version for an application.
Other libraries that the project depends on (via project references or NuGet package references).
For executable projects targeting versions earlier than .NET Core 3.0, library dependencies from NuGet are typically NOT copied to the output folder. They’re resolved from the NuGet global packages folder at run time. With that in mind, the product of dotnet build isn’t ready to be transferred to another machine to run. To create a version of the application that can be deployed, you need to publish it (for example, with the dotnet publish command). For more information, see .NET Application Deployment.
For executable projects targeting .NET Core 3.0 and later, library dependencies are copied to the output folder. This means that if there isn’t any other publish-specific logic (such as Web projects have), the build output should be deployable.