ASchabus
ASchabus

Reputation: 51

F# fake build - ignore error from MSBuildRelease

I use fake to build multiple Visual Studio Projects via: MSBuildRelease buildDir "Build" appReferences. If all projects compile without errors everything works fine, but when one project returns an error, the sequence stops. How can I continue compiling all Projects, even if some may give an error.

Upvotes: 1

Views: 359

Answers (1)

Yemi Bedu
Yemi Bedu

Reputation: 312

FAKE has support for Build Failure Targets and Final Targets. These are One shot calls in the event of failure for the first and at the end of other Targets for the latter. It doesn't show dependency association.

http://fsharp.github.io/FAKE/specifictargets.html

You can however get all your targets with getAllTargetNames and run each target you want alone with runSingleTarget. The GetErrors gives back a mutable list, so you check if the last error is severe enough and then log it and either stop or push a new empty list into errors. Seeing the code:

let mutable private errors = []

so something like

GetErrors() <- []

might allow you to skip over Targets in error. You can also put the errors in another parent list and reassign at the very end. That way you can post activate the Build Failure Targets runBuildFailureTargets and Final Targets runFinalTargets to do their expected processing.

https://github.com/fsharp/FAKE/blob/master/src/app/FakeLib/TargetHelper.fs

Upvotes: 0

Related Questions