Net 7 Console App with Serilog: Step-by-Step Instructions May 25, 2023

This article explains how to create a console application with logging in place using .Net SDK, Visual Studio, and Serilog. It covers setting up the project, configuring dependency injection, creating the base application, and adding Serilog. It also explains the purpose of each NuGet package used and how to configure Serilog using the Configuration Manager and Dependency Injector.

I’m a big fan of doing Proof of Concepts using a console application. The reason for this is that often what is being looked into has zero UI requirements so why use one? I also like to make sure that I have logging in place to help me understand what is going on. Below I will show how to achieve this simply.

...
Moving to Hugo Apr 4, 2023

Why

Why did I move my site to Hugo? I wonder that myself, but at the end of the day there is a simple reason…. ease.. Well in theory, we will see how it goes.

Jekyll

I looked a Jekyll and almost went with it. But was not sure, you never know I may well move this to Jekyll at a later point.

Other Sites

I’m going to try to cross post some of my stuff to Hashnode, or I may well just post on Hashnode. I will be using the domain kenlea.blog.

NuGet Packages May 2, 2020

I can never remember how to limit what versions of NuGet packages are allowed for a project. So here are how it’s done

Version ranges and wildcards

When referring to package dependencies, NuGet supports using interval notation for specifying version ranges, summarized as follows:

NotationApplied ruleDescription
1.0x ≥ 1.0Minimum version, inclusive
(1.0,)x > 1.0Minimum version, exclusive
[1.0]x == 1.0Exact version match
(,1.0]x ≤ 1.0Maximum version, inclusive
(,1.0)x < 1.0Maximum version, exclusive
[1.0,2.0]1.0 ≤ x ≤ 2.0Exact range, inclusive
(1.0,2.0)1.0 < x < 2.0Exact range, exclusive
[1.0,2.0)1.0 ≤ x < 2.0Mixed inclusive minimum and exclusive maximum version
(1.0)invalidinvalid
Visual Studio :- CodeLens Nov 20, 2019

Every now and again part of the Visual Studio code display vanishes on me and I can never remember the setting

Visual Studio CodeLens Visual Studio CodeLens

In order to get it back I need to re-enable the CodeLens in the Visual Studio options

Visual Studio CodeLens Options Visual Studio CodeLens Options

Securing Raspberry Pi Jan 14, 2019

Securing your Pi is a must especially if you are planning to have your Pi open to the outside world. (e.g. act as a web server). Below are details of some of what you should do.

Add New User

One issue with the Raspberry Pi is that the default user will always be pi. You may want to create another user to make the Pi a more secure, you can then delete the default user.

...
Headless Mode Dec 15, 2018

Normally when I’m running my Pi I don’t have it connected to a monitor or keyboard. This means that when installing it, I need to install it in headless mode. Below are details on how I setup in headless mode. Before doing this, you need to setup the SD Card as detailed in Building Raspberry Pi.

Step 1: Enable SSH

SSH is what I use to connect to my Pi. How I connect to my Pi and is disabled by default. However, it is possible to enable it from initial boot by creating a file called ssh on the root of the SD Card. This will enable ssh for one time only, I will explain later how to permanently enable it. NOTE: If you are using Windows make sure that the file is created with no extension. On Mac or Linux you can simply type ‘touch ssh’ and copy that file onto the SD Card

...
Building Raspberry Pi Dec 15, 2018

Raspberry Pi 3+ Raspberry Pi 3+

A few days ago I managed to remove files from my Pi that stopped it working. I was thinking about rebuilding it anyway so figured now is the time to do it. Details for installing the Pi are below

Step 1: Download the latest version of Raspbain Lite

This can be downloaded from the following URL https://www.raspberrypi.org/downloads/raspbian/

Step 2: Unzip download

The download is a compressed file so you need to unzip it. There are plenty of tools out there that enable you to do this.

...