I've been hardening our build pipelines and moved the runtime into the csproj to ensure local builds and command line build/publish (in the pipeline) have the same runtime.
However I'm now questioning myself, as the published output when publishing locally does not have the runtime in the folder path (unlike how it is documented).
If not specified, it defaults to [project_file_folder]/bin/[configuration]/[framework]/publish/ for a framework-dependent executable and cross-platform binaries. It defaults to [project_file_folder]/bin/[configuration]/[framework]/[runtime]/publish/ for a self-contained executable.
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish#arguments
It is leading me to think that the runtime in csproj is just for nuget restores?
i.e. is dotnet build --runtime [runtime] actually just passed to dotnet restore --runtime [runtime]
Whereas the runtime for dotnet publish is for the actual framework independent self-contained builds?
Background
The reason I haven't noticed this sooner is that I am doing explicit:
NuGetAuthenticate (Azure Pipeline task for authenticating private feeds) dotnet restore dotnet build dotnet publish -self-contained --no-build
I assumed the publish was using the RuntimeIdentifiers in the csproj, but I think now perhaps it's a cross platform platform build and possibly self containing under the current runtime of the build agent!