The task Clean fails when the Pester Module is loaded somewhere, because of the gherkin.dll is in use.
That means if you run a first time it works, the second it fails.
Workarounds I can think of:
Clean the $BuildOutput folder excludin the modules subfolder (not nice as if Dependency.psd1 is missing a pre-installed entry it won't be picked up). Not 100% Clean.
Catch the Exception and display warning instead, but carry on on failed Clean. Not 100% Clean.
Start new PowerShell process, kill current session. In the new Process add a delay (i.e. 1sec), pushd then Invoke-Build. 100% Clean but that means terminal hopping... nasty...
The task Clean fails when the Pester Module is loaded somewhere, because of the gherkin.dll is in use. That means if you run a first time it works, the second it fails.
Workarounds I can think of:
$BuildOutput
folder excludin themodules
subfolder (not nice as if Dependency.psd1 is missing a pre-installed entry it won't be picked up). Not 100% Clean.