JandaBox Console App - Jandini/JandaBox GitHub Wiki

ConsoleBox .NET template provides solution for console application with dependency injection, logging, and configuration. Default logger is Serilog. Use --serilog false parameter to switch to Microsoft console logger.

Template Options

  • --basic Create basic console application with minimal amount startup code. Default value is false.

  • --serilog Use Serilog. Default value is true.

  • --async Create asynchronous code. Default value is false.

  • --single Publish as single file, self contained, win-x64 console application.

  • --gitVersion Add semantic versioning with GitVersion. The code created with this parameter can be only build from initialized git repository.

    dotnet new consolebox -n MyApp --git
    cd MyApp
    git init -b main
    git add .
    git commit -m "First commit"
    dotnet build src
    

Template features

  • Repository Layout
    • The src and bin folders
    • Default README.md file
    • Default .gitignore file
    • Default launchSettings.json file
  • Dependency Injection
    • Main service with logging
    • Dispose service provider
  • Logging
    • Serilog or Microsoft log providers
    • Serilog environment enrichers
    • Unhandled exceptions logging
  • Configuration
    • Embedded appsettings.json file
    • Override embedded appsettings.json with a file
    • Configuration binding
  • Semantic Versioning
    • GitVersion.MsBuild package
    • Configuration GitVersion.yml file
  • Command Line Parser
    • Verbs and options parser
  • Asynchronous code
    • Run Main with async and await
  • Release build without debug symbols
    • Conditional project parameters for Release configuration to suppress debug symbols

Basic console application

Create basic console application with Microsoft console logger

dotnet new consolebox -n Basic --basic --serilog false	

or console application with Serilog.

dotnet new consolebox -n Basic --simple

Default console application

Create console application with Serilog to console and file.

dotnet new consolebox -n MyApp

You can create console application with Microsoft console logger only.

dotnet new consolebox -n MyApp --serilog false