Fixing 'Could not inject value for GitVersion' in Azure Pipelines

If you are using GitVersion with NUKE and you are trying to get the pipeline working, but are running into the build failing with Could not inject value for GitVersion.

I will assume you are using a YAML pipeline (and in my case I was pulling the sources from GitHub), try this.

First open the pipeline that is experiencing issues and go select ‘Edit’:

Screenshot of Azure Pipelines overview.

Select the additional settings that are collapsed and go to ‘Triggers’:

Expanded additional settings with Triggers highlighted

Running GitVersion as a .NET Core local tool in FAKE

Recently I wanted to use GitVersion to determine the version number for a project. To keep the project self-contained I installed GitVersion as a .NET Local Tool. However, when trying to get the generated version numbers through FAKE it didn’t work.

Unfortunately, the current version of FAKE does not support running GitVersion as a dotnet tool. To bridge that gap I wrote the following FAKE script to get it to work.