Working to compile Simple.Web on Mono this week needed to pass properties to xbuild via build tool “FAKE” (F# Make), although the solution applies equally to Windows/MSBuild.
I’m new to both F# and FAKE having only spent a few hours delving into the source-code; as such it’s likely their is a better way of achieving the below. If you are interested in FAKE I suggest hooking yourself up to the Google Group.
In this scenario Sandbox.csproj uses $(VSToolsPath) in it’s project file, as xbuild/Mono won’t substitute this upon compilation I need to pass our path in as a property. We are also capitalising our build target as FAKE is case-sensitive in this regard.
First of all let’s update our script with a parameter that defaults:
Now we need to update our FAKE .fsx file to pass this to the build process. This requires us to first retrieve the environment variable with environVarOrDefault and bypass the usual MSBuildRelease and MSBuildDebug methods going instead directly to MSBuild:
Note: If you are running Mono 2.11 + it is likely that fsi and fsc have been replaced with fsharpi and fsharpc, I suggest you (like me) create two bash scripts to redirect any calls by FAKE (see fsc:here and fsi:here).