Exploring the .NET Core 2.1 Docker files (updated): dotnet:runtime vs...
This is an update to my previous post explaining the difference between the various Linux .NET docker files. Things have changed a lot in .NET Core 2.1, so that post is out of date! When you build and...
View ArticleSuppressing the startup and shutdown messages in ASP.NET Core
In this post, I show how you can disable the startup message shown in the console when you run an ASP.NET Core application. This extra text can mess up your logs if you're using a collector that reads...
View ArticleWriting logs to Elasticsearch with Fluentd using Serilog in ASP.NET Core
For apps running in Kubernetes, it's particularly important to be storing log messages in a central location. I'd argue that this is important for all apps, whether or not you're using Kubernetes or...
View ArticleBuilding ASP.NET Core apps on both Windows and Linux using AppVeyor
Nearly two years ago I wrote a post about using AppVeyor to build and publish your first .NET Core NuGet package. A lot has changed with ASP.NET Core since then, but by-and-large the process is still...
View ArticleBuilding .NET Framework ASP.NET Core apps on Linux using Mono and the .NET CLI
I've been hitting Docker hard (as regulars will notice from the topic of recent posts!), and thanks to .NET Core, it's all been pretty smooth sailing. However, I had a requirement for building a...
View ArticleAdding validation to strongly typed configuration objects in ASP.NET Core
In this post I describe an approach you can use to ensure your strongly typed configuration objects have been correctly bound to your configuration when your app starts up. By using an IStartupFilter,...
View ArticleConverting web.config files to appsettings.json with a .NET Core global tool
In this post I describe how and why I created a .NET Core global tool to easily convert configuration stored in web.config files to the JSON format more commonly used for configuration in ASP.NET...
View ArticleCreating an If Tag Helper to conditionally render content
One of the best features added to ASP.NET Core Razor is Tag Helpers. These can be added to standard HTML elements, and can participate in their rendering. Alternatively, they can be entirely new...
View ArticleThe ASP.NET Core Generic Host: namespace clashes and extension methods
ASP.NET Core 2.1 introduced the ASP.NET Core Generic Host for non-HTTP scenarios. In standard HTTP ASP.NET Core applications, you configure your app using the WebHostBuilder in ASP.NET Core, but for...
View ArticleAdding Serilog to the ASP.NET Core Generic Host
ASP.NET Core 2.1 introduced the ASP.NET Core Generic Host for non-HTTP scenarios. In standard HTTP ASP.NET Core applications, you configure your app using the WebHostBuilder in ASP.NET Core, but for...
View ArticleUsing snake case column names with Dapper and PostgreSQL
This is a follow on to a previous post about customising naming conventions for PostgreSQL and EF Core. In this post I describe one way to use snake case naming conventions when using Dapper, rather...
View ArticleAdding Segment client-side analytics to an ASP.NET Core application
Virtually all web applications use some form of user analytics to determine which aspects of an application are popular and which are causing issues for users. Probably the most well known is Google...
View ArticleRunning smoke tests for ASP.NET Core apps in CI using Docker
In this post I'll discuss a technique I use occasionally to ensure that an ASP.NET Core app is able to start correctly, as part of a continuous integration (CI) build pipeline. These "smoke tests"...
View ArticleWhy isn't my ASP.NET Core environment-specific configuration loading?
I was recently standing up a new ASP.NET Core application running in Docker, and I was seeing some very strange behaviour. The application would start up without any problems when running locally on...
View ArticleThe difference between GetService() and GetRequiredService() in ASP.NET Core
This post looks at the GetService<T>() and GetRequiredService<T>() methods of the default/built-in ASP.NET Core DI container, provided in Microsoft.Extensions.DependencyInjection. I'll...
View ArticleHow to register a service with multiple interfaces in ASP.NET Core DI
In this post I describe how to register a concrete class with multiple public interfaces in the Microsoft.Extensions.DependencyInjection container used in ASP.NET Core. With this approach you'll be...
View ArticleUsing Scrutor to automatically register your services with the ASP.NET Core...
In this post I describe how to use the open source library Scrutor by Kristian Hellang to add assembly scanning capabilities to the ASP.NET Core DI container. Scrutor is not a dependency injection...
View ArticleAdding decorated classes to the ASP.NET Core DI container using Scrutor
In my last post, I described how you can use Scrutor to add assembly scanning to the ASP.NET Core built-in DI container, without using a third-party library. Scrutor is not intended to replace...
View ArticleCreating an ASCII-art tree in C#
I recently made my first pull request to the Cake project in which I added a command line option (--showtree) to display the tasks in a Cake script in a tree view. Creating the tree view itself took...
View ArticleBuilding an open source GitHub project using Azure DevOps
In this post I show how I added Azure DevOps CI to one of the .NET Standard library I have on GitHub. I'll walk through the various steps I took to get CI/CD working for pull requests and the master...
View Article