Example Console App for NetCore

Is there an example of a .net6.0 console application using the new Configure.AppHost.cs pattern?
I want to migrate from the legacy UseModularStartup() pattern.

AppHost is for Web Apps, all new projects templates use the new Modular Startup configuration:


“web” and “empty” creates a minimal 4 project or 1 project solution. If you wanted a C# console app you can use the mix script:

$ x mix console-cs

Which uses the directory name as the project name.

Thanks, but I am trying to migrate to this new 6.0 pattern away from the 5.X ModularStartup pattern (as per the docs).
I’ve done that for my actual web apps, but now need to tackle my other hosts.

I already have a console app that has an API at localhost:5656.
and I have xUnit integration tests that do exactly the same thing (using WebHost.CreateDefaultBuilder in the test harness)

Both Console App and Integration Tests use this common pattern at the moment:

Program.cs / ApiSpecBase.cs

private const string ApiBaseUrl = "https://localhost:5656"

private static void Main(string[] args)
                var webHost = WebHost.CreateDefaultBuilder(Array.Empty<string>())

                Console.WriteLine(@"Services are listening at: '{0}'".Fmt(ApiBaseUrl));

Startup.cs / TestStartup.cs

public class Startup : ModularStartup
        public new void ConfigureServices(IServiceCollection services)
            services.AddLogging(builder =>

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
            app.UseServiceStack(new ServiceHost
                AppSettings = new NetCoreAppSettings(Configuration)

Are you saying that there is nothing to do to migrate here?
I was hoping to move away from the legacy ModularStartup pattern?

All .NET6 Web Apps are Console Apps, so you should be able to follow the same strategy you did when migrating your Web Apps.

We don’t use multiple Modular Startup configurations in our integration test AppHosts that’s typically small and focused and maintained in the same class as the integration test, e.g: