Fix for metadata generation failed exit code: 2147450750 loading wrong version of DLLs when building Azure Functions

The Problem Recently an Azure DevOps Pipeline for a .NET 6 based Azure Functions started to fail on some of our self-hosted build agents with the error ##[error]C:\Users\Administrator\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\4.0.1\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): Error : Metadata generation failed. Exit code: '-2147450750' Error: 'Failed to load the dll from [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App\3.1.32\hostpolicy.dll], HRESULT: 0x800700C1An error occurred while loading required library hostpolicy.dll from [C:\hostedtoolcache\windows\dotnet\shared\Microsoft.NETCore.App\3.1.32]' The pipeline it self was simple, just repeating the steps a developer would use locally...

July 19, 2023 · 3 min · Richard Fennell

Update on sending social media posts from Hugo based static site

Around a year ago I posted on ‘Social Media Posts after Migrating from WordPress to Hugo Static Pages’. Recently I have found that the Twitter functionality in my Logic App was failing. Turns out this was due to the changes in the Twitter Free API, with them moving from V1 to V2 which requires OAuth authentication as opposed to a Bearer token. In essence the core of the problem is that the built-in Logic Apps Twitter Connector only supports the V1 Twitter API....

July 13, 2023 · 1 min · Richard Fennell

How to run your own maintenance job on Azure DevOps pipelines

Updated: 19 Jul 2023 - Revised the post to use Az CLI Task as opposed to a PowerShell Task Updated: 29 Aug 2024 - Revised the PowerShell as original version was not working. Also see follow up post on using Workload Identity federation Background Azure DevOps Pipelines have a built in mechanism to run maintenance jobs on a schedule. This is great for cleaning out old temporary data, but what if you want to run your own maintenance job?...

July 12, 2023 · 5 min · Richard Fennell

Bit rot is killing my pipelines

In a modern hybrid cloud world we have to accept constant change as the norm. You can’t just build something and forget about it. You have to keep it up to date as newer tools/libraries appear. This is to at least address security issues, even if you don’t want to adopt the new features. So I am expecting a degree of maintenance work on my Azure DevOps pipelines. However, this is becoming more awkward as many of the tasks used by Azure Pipelines, even ones from Microsoft, are themselves not being maintained....

April 26, 2023 · 2 min · Richard Fennell

Moving my Azure DevOps Pipeline generated social posts to Azure Logic Apps

I posted a while ago about how I had automated the generation of social media posts for my static Hugo based website using Azure Logic Apps. The other place I auto-generate social media posts is from releases via my project’s Azure DevOps Pipeline builds. These use a YAML Pipeline Template that calls a Marketplace task to post to Twitter and a PowerShell task to Invoke-WebRequest to post to Mastodon. Recently the Twitter task started to fail, and given the recent changes to the Twitter API with the move to the V2 API, I decided a new solution was required....

April 25, 2023 · 2 min · Richard Fennell