Giter VIP home page Giter VIP logo

sawyercsharpconsole's Introduction

Sawyer's Console Template

This repo is a template for the .NET SDK to make a slightly more batteries included console csproj, subject to my preferences.

This is a companion to A Beginner's Guide to .NET's HostBuilder.

Installation

Here are the steps in bash:

template_dir=~/.dotnetTemplates/SawyerCSharpConsole
git clone https://github.com/sawyerwatts/SawyerCSharpConsole.git $template_dir
rm -rf $template_dir/.git
rm $template_dir/.gitignore
rm $template_dir/.editorconfig
rm $template_dir/README.md
rm $template_dir/LICENSE
dotnet new install $template_dir

Here are the steps in PowerShell:

$templateDir="$env:USERPROFILE\.dotnetTemplates\SawyerCSharpConsole"
git clone https://github.com/sawyerwatts/SawyerCSharpConsole.git $templateDir
rm $templateDir\.git -r -force
rm $templateDir\.gitignore
rm $templateDir\.editorconfig
rm $templateDir\README.md
rm $templateDir\LICENSE
dotnet new install $templateDir

Uninstallation

Here are the steps in bash:

template_dir=~/.dotnetTemplates/SawyerCSharpConsole
dotnet new uninstall $template_dir
rm -rf $template_dir

Here are the steps in PowerShell:

$templateDir="$env:USERPROFILE\.dotnetTemplates\SawyerCSharpConsole"
dotnet new uninstall $templateDir
rm $templateDir -r -force

Features

  1. This uses the Worker SDK, so it has access to the HostApplicationBuilder, allowing easy dependency injection and access to the appsettings*.json files.
  2. This comes pre-baked with Serilog configured as the implementation to the built in ILogger<T>, and these settings are controlled via the appsettings*.json files. Serilog is configured to buffer file writes and to write file and console logs via a background thread.
  3. Program supplies a CancellationToken to Driver.RunAsync, and it will mimic the functionality that the various web/app hosts supply when managing long-running applications: interrupt signals are captured by the host, the host will update the CancellationToken so the app can gracefully shut down, and if the app doesn't close in five seconds, then the app will be forcefully closed.
  4. Driver has Settings and RegisterTo, an easy reminder how to best register settings POCOs with validation on startup.

sawyercsharpconsole's People

Contributors

sawyerwatts avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.