markrendle/Simple.Web — pull request #14 by ianbattersby (2012-08-04 23:08:27+00:00)
Title: Mono build compatibility improvements against FAKE 1.64.7 and Mono 2.11.x 

Forewarning
------------------
Due to an issue with Mono xbuild 2.11.2.0 and absolute paths, which ironically also shows up when FAKE attempts to compile using relative paths, it's difficult to be confident we're 100% there on Mono builds yet. Mono xbuild 2.10.9 doesn't have the issue with paths but the compiler has a variance validity issue causing IInput.cs contravariance to error.

Xamarin bugzilla reports;
- [The variance validity issue in 2.10.9 reported here, is fixed in 2.11.x.] [1]
- [The xbuild absolute path issue in 2.11.2.0 is reported here.] [2]

Pull Request
------------
This request contains the following key elements:

**build.fsx:**
- Back-slashed paths changed to forward-slashed. This doesn't upset the Windows build.cmd as FAKE converts for that environment (verified), but unfortunately the reverse isn't *always* true.
- Uses environment variable "BUILDTARGETS" (if present) to hold framework WebApplications library path for build properties such as $(VSToolsPath) used in Sandbox.csproj. This shouldn't affect the Windows build even though not set in build.cmd (verified locally).
- Bypassed `MSBuildRelease` FAKE method and invoked `MSBuild` directly in order to pass in $(VSToolsPath) property.
- Introduced target dependencies for "Build" requiring "Clean" and "BuildTest" requiring "Build" (and thus "Clean").

**fake.sh:**
- Introduced optional parameter for BUILDTARGETS which translate to properties such as $(VSToolsPath). Defaults to v9.0 of the standard Mono WebApplications xbuild library files (nb: suspect different path on *nix).
- Now instructs FAKE to use 'verbose' paths (see notes above).
- Moved to call FAKE 1.64.7 which resolves issue with parsing *nix paths in project files.

**Sandbox.csproj / SimplestWeb.csproj:**
- Removed unused references to System.Web.Entity as caused Mono build warnings.

Summary
-------------
- After the xbuild path issue is resolved this should all compile on Mono 2.11+ using FAKE 1.64.7.
- Those using Mono 2.11.x might need (like me) might need to bash redirect [FSI] [3] and [FSC] [4].
- Need to chase up on Mono support for System.Data.Entity.Design.PluralizationServices as 2.11.2.0 doesn't seem to have it out of the box.

[1]: https://bugzilla.xamarin.com/show_bug.cgi?id=6360 "Xamarin bugzilla report 6360 - Variance validity in 2.10.x"
[2]: https://bugzilla.xamarin.com/show_bug.cgi?id=6389 "Xamarin bugzilla report 6389 - xbuild absolute path issue in 2.11.2.0"
[3]: https://gist.github.com/3260445 "Gist of bash script redirecting FSC to fsharpc"
[4]: https://gist.github.com/3260447 "Gist of bash script redirecting FSI to fsharpi"