Framework-standard: content root, default configuration sources (host configuration, appsettings.json, appsettings.{Environment}.json, user secrets in Development, environment variables, command-line args), console/debug/EventSource/EventLog logging providers, and DI scope validation in Development.
Append configuration sources through ConfigureAppConfiguration: AddJsonFile("appsettings.json", optional: true) and AddEnvironmentVariables() (WS-BR-03).
Effect: because later providers win, these re-added sources take precedence over the command-line source and over appsettings.{Environment}.json, inverting the standard .NET precedence order. See Configuration for the full consequence list.
Enable Windows Service hosting with .UseWindowsService().
Sets WindowsServiceLifetime and the content root to AppContext.BaseDirectory when the process runs under the SCM; it is a no-op otherwise, so the same executable runs as a console app for debugging.
Return the builder. The library registers no services itself.
None specific to this operation; failures from the appended providers surface later when a key is read (for example, DelayStart in Create and configure the host).
Running outside the SCM makes .UseWindowsService() a no-op, so the process behaves as a plain console app.