Getting x86 .NET 3.x tests running on the latest Azure Devops hosted agents

Background At Black Marble we have our own private build agents, but they are built using the same Packer process as the Microsoft hosted ones. I recently rebuilt our agents to match the latest version of the hosted agents, and I ran into an issue with some .NET 3.1 based x86 MSTests. The tests were failing with the following error: A total of 34 test files matched the specified pattern. ##[error]Testhost process exited with error: A fatal error occurred....

March 6, 2023 · 2 min · Richard Fennell

Getting "cannot find path" error using Install-Package

Background I was recently trying to use PowerShelGet Install-Package to install a module from an Azure DevOps Artifacts hosted PowerShell Gallery using the following script # For authentication use a PAT as the password, UID can be anything $PATcreds = Get-Credential Register-PSRepository -Name BM -SourceLocation 'https://pkgs.dev.azure.com/<org>/_packaging/PowerShell/nuget/v2' -PublishLocation 'https://pkgs.dev.azure.com/<org>/_packaging/PowerShell/nuget/v2' -InstallationPolicy Trusted Install-Package BlackMarble.Package -Source BM -Credential $PATcreds The script did not work I was getting the error Install-Package : Cannot find the path ‘C:\Users<user>\AppData\Local\Temp\936930114\BlackMarble....

February 27, 2023 · 1 min · Richard Fennell

What happens when you link an Azure DevOps Variable Group to an Azure Key Vault?

Background It is a really useful feature that you can expose Key Vault stored secrets as Azure DevOps pipeline variables via a variable group, but what happens when you do this? And what can you do if you try to expose too many variables? I was recently working on a system where there was an increasing number of Key Vault secrets that were being exposed as variables via a variable group....

February 13, 2023 · 2 min · Richard Fennell

Handling return values from Azure Functions in Hugo static website

Background I am using an Azure Function as backend for processing forms submissions from a Hugo static website, to process a simple contact form. I wanted to add reCAPTCHA support, as the site was generating too many spam emails. I also wanted to show a different confirmation pages depending on whether the reCAPTCHA check passed or failed There a good few posts about using an Azure Function as backend for a static web site form....

January 20, 2023 · 4 min · Richard Fennell

Could not find assembly deploying a dotnet 6 console app

Problem After deploying a dotnet 6 console app to a production server, I got the following error: Exception: [Could not load file or assembly ‘System.Data.Odbc, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’. The system cannot find the file specified.] The strange thing was the same EXE, built on a Microsoft hosted Azure DevOps build agent, was working on the test server and was deployed using the same Azure DevOps Pipeline to both systems. I tried many things to work out what the problem was....

January 13, 2023 · 2 min · Richard Fennell