Stage failing in Azure DevOps pipeline

How to avoid global.json version conflicts in Azure DevOps

Sometimes in Azure DevOps, you have a project that’s being built with certain .NET version. It’ll require that particular SDK version, and most typically that is defined in global.json file. However, if you also need to install a certain .NET tool, running dotnet tool install MyBuildTool will fail. And it’ll fail before it actually tries to install the version of the tool you wanted to! This article explains how to…Continue reading How to avoid global.json version conflicts in Azure DevOps

Have you tried turning it off and on again?

How to replace and reload application settings changes in .NET?

This article explains a curious workaround that I figured out. In case you need a way to force appsettings s changes to be reflected in some libraries you need in your application, even if they don’t support any configuration after application startup. Problem Normally, a .NET application loads the configuration – environment variables, appsettings.json files, wherever your secrets come from and all the other good stuff – when it’s started,…Continue reading How to replace and reload application settings changes in .NET?

How to copy dependent assemblies to the bin folder on build?

This is something that comes up pretty often – when you’re building an application, or maybe a library you’re sharing as a NuGet package to your friends: You’ll need to share a dependency or two with your particular package, and you don’t want your end users having to reference those libraries, too. Sounds easy, right? But alas, it’s not as simple as one would like :) (Well, unless you’re happy…Continue reading How to copy dependent assemblies to the bin folder on build?

401 Unauthorized meme

How to secure your WebSocket connection using .NET Core?

This article explains how to easily authenticate your WebSocket connections using .NET Core and vanilla JavaScript. The same concept probably applies to all sorts of front-end libraries, although some of them might offer some syntactic sugar on top of it. But it’s simple, and keeping your implementation simple is generally speaking a good idea. So – this one came up when developing a simple API that’d expose a WebSocket endpoint…Continue reading How to secure your WebSocket connection using .NET Core?

While only a few countries use absurd date formats (such as the Month-first approach adopted by some former European colonies), there's no shortage of different date formats out there. Source: John Harding/Mona Chalabi

Experiment: DateTime formats

This article explains how to loop through all supported cultures on any given machine that’s able to run .NET. The code sample is in C# and outputs an HTML table you can copy – but obviously you can adapt it to your needs! This was something I needed to support some weird documentation task way back when – and it took me like a year to finish this blog post…Continue reading Experiment: DateTime formats