Code Buckets

Buckets of code

Farewell to Microsoft

Happy new year! It looks like 2022 will be the year that I say a fond farewell to .Net and Microsoft technologies generally.  It’s been a 20-year relationship with Microsoft and we’ve both seen changes in each other but our…

Buddhist Texts API: Dhammapada

A while ago I was looking for an API which provided Buddhists Texts and I couldn’t finda good one – so I’ve created one myself and published it. I’ve started with the Dhammapada which is pretty much the most well-known…

Deploying Asp.Net Core and MySQL into Linux Docker Containers – and Populating the Database

I’ve written an .Net Core API that I want to deploy out. I want to use all open-source software so it’s going to be using a MySQL database and be hosted on a Linux box somewhere. The Task I want…

Applying Entity Framework Migrations to a Docker Container

I’m going to run through how to deploy an API and a database into two separate Docker containers then apply Entity Framework migrations. This will create and populate the database with the correct schema and reference data. My idea was…

NuGet restore failing in Docker Container

I was tempted to write about this before, but I didn’t as there is already a very good, highly rated stack overflow answer with the solution. However, I’m just reinstalling Docker desktop and getting things working again and I wish…

Blocked by CORS policy? Unblocking in .Net Core 3

A while ago I wrote an post about hosting Angular under an existing IIS website. Quite a few people seem to have found it useful which is good. My motivation was to avoid CORS policy errors i.e blocked JavaScript requests…

Dynamically Loading Assemblies for Dependency Injection in .Net Core

We want to get all our assemblies registered for Dependency Injection in a .Net Core 3 application by scanning the bin folder and registering all the classes which implement a specific interface. Bit of a mouthful so a simple (and…

Converting .Net Standard Libraries to .Net Core

I was looking for a quick answer to this on the internet and couldn’t find it. So here it is Open your .Net Standard csproj file in notepad or similar text editor. You’ll see this structure <Project Sdk=”Microsoft.NET.Sdk”> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework>…

LINQ FirstOrDefault implementation in TypeScript

Confession: when working in JavaScript languages I kind of miss some C# things such as LINQ. A substantial part of my C# coding seemed to be chaining LINQ operators together. So rather than staring wistfully out of the window  in…

.Net Core 2.0: project.assets.json’ doesn’t have a target for ‘.NETStandard,Version=v2.0’

The Problem Odd error when building a .net core project with Visual Studio Code. This built a few weeks ago – went back it it and I’m getting this C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file ‘myproject\obj\project.assets.json’ doesn’t have a target…