[Pkg-cli-apps-commits] [fsharp] 09/71: Integrate fsharp/fsharp master into fsharp_31

Christopher Halse Rogers raof-guest at moszumanska.debian.org
Fri Jan 17 05:18:08 UTC 2014


This is an automated email from the git hooks/post-receive script.

raof-guest pushed a commit to tag 3.1.0
in repository fsharp.

commit 2894b8484e159b0eeea86e8f64d5befb1d9e2d2a
Merge: d4e8b9b 3b933f7
Author: Don Syme <donsyme at fastmail.fm>
Date:   Thu Oct 3 13:06:25 2013 +0100

    Integrate fsharp/fsharp master into fsharp_31

 .gitattributes                                     |    22 +
 .gitignore                                         |    47 +-
 Makefile.in                                        |     2 +-
 README                                             |    25 -
 README-original.md                                 |    11 +
 README.html                                        |   589 -
 README.md                                          |   209 +
 autogen.sh                                         |     3 +-
 build.bat                                          |    20 +
 config.make.in                                     |   139 +-
 configure.ac                                       |    69 +-
 dependencies/mono/2.1/MonoDroid.FSharp.targets     |    11 +
 dependencies/mono/2.1/MonoTouch/System.Core.dll    |   Bin 0 -> 347136 bytes
 dependencies/mono/2.1/MonoTouch/System.dll         |   Bin 0 -> 1044480 bytes
 .../mono/2.1/MonoTouch/mscorlib-runtime.dll        |   Bin 0 -> 2598400 bytes
 dependencies/mono/2.1/MonoTouch/mscorlib.dll       |   Bin 0 -> 2845184 bytes
 dependencies/mono/2.1/System.Core.dll              |   Bin 0 -> 717312 bytes
 dependencies/mono/2.1/System.dll                   |   Bin 0 -> 1128960 bytes
 dependencies/mono/2.1/mscorlib.dll                 |   Bin 0 -> 2733568 bytes
 launcher.in                                        |    18 +-
 lib/bootstrap/2.0/FSharp.Build.dll                 |   Bin 48128 -> 0 bytes
 lib/bootstrap/2.0/FSharp.Build.dll.mdb             |   Bin 7087 -> 0 bytes
 lib/bootstrap/2.0/FSharp.Build.xml                 |   350 -
 lib/bootstrap/2.0/FSharp.Compiler.dll              |   Bin 10700288 -> 0 bytes
 lib/bootstrap/2.0/FSharp.Compiler.dll.mdb          |   Bin 1371349 -> 0 bytes
 lib/bootstrap/2.0/FSharp.Compiler.xml              | 37464 ------------------
 lib/bootstrap/2.0/FSharp.Core.dll                  |   Bin 969728 -> 1651200 bytes
 lib/bootstrap/2.0/FSharp.Core.dll.mdb              |   Bin 200742 -> 0 bytes
 lib/bootstrap/2.0/FSharp.Core.optdata              |   Bin 279223 -> 0 bytes
 lib/bootstrap/2.0/FSharp.Core.sigdata              |   Bin 411157 -> 0 bytes
 lib/bootstrap/2.0/FSharp.Core.xml                  |  9198 -----
 lib/bootstrap/2.0/FSharp.PowerPack.Build.Tasks.dll |   Bin 0 -> 22016 bytes
 lib/bootstrap/2.0/FSharp.PowerPack.targets         |    86 +
 lib/bootstrap/2.0/FSharp.SRGen.Build.Tasks.dll     |   Bin 0 -> 9216 bytes
 lib/bootstrap/2.0/FSharp.SRGen.targets             |    69 +
 lib/bootstrap/2.0/fsc.exe                          |   Bin 180736 -> 0 bytes
 lib/bootstrap/2.0/fsc.exe.mdb                      |   Bin 23243 -> 0 bytes
 lib/bootstrap/2.0/fsc.xml                          |   557 -
 lib/bootstrap/2.0/fsi.exe                          |   Bin 232248 -> 0 bytes
 lib/bootstrap/2.0/fsi.exe.config                   |     6 -
 lib/bootstrap/4.0/FSharp.Build.dll                 |   Bin 48128 -> 50176 bytes
 lib/bootstrap/4.0/FSharp.Build.dll.mdb             |   Bin 7088 -> 0 bytes
 lib/bootstrap/4.0/FSharp.Build.xml                 |   355 -
 .../4.0/FSharp.Compiler.Interactive.Settings.dll   |   Bin 0 -> 22016 bytes
 .../4.0/FSharp.Compiler.Server.Shared.dll          |   Bin 0 -> 7680 bytes
 lib/bootstrap/4.0/FSharp.Compiler.dll              |   Bin 10704896 -> 11620864 bytes
 lib/bootstrap/4.0/FSharp.Compiler.dll.mdb          |   Bin 1371685 -> 0 bytes
 lib/bootstrap/4.0/FSharp.Compiler.xml              | 37484 -------------------
 lib/bootstrap/4.0/FSharp.Core.dll                  |   Bin 938496 -> 1121752 bytes
 lib/bootstrap/4.0/FSharp.Core.dll.mdb              |   Bin 186797 -> 0 bytes
 lib/bootstrap/4.0/FSharp.Core.optdata              |   Bin 271508 -> 352356 bytes
 lib/bootstrap/4.0/FSharp.Core.sigdata              |   Bin 388807 -> 486047 bytes
 lib/bootstrap/4.0/FSharp.Core.xml                  |  8727 -----
 lib/bootstrap/4.0/Microsoft.FSharp.Targets         |   262 +
 lib/bootstrap/4.0/Microsoft.FSharp.targets         |   280 +-
 lib/bootstrap/4.0/fsc.exe                          |   Bin 180736 -> 28672 bytes
 lib/bootstrap/4.0/fsc.exe.mdb                      |   Bin 23245 -> 0 bytes
 lib/bootstrap/4.0/fsc.xml                          |   557 -
 lib/bootstrap/4.0/fsi.exe                          |   Bin 223744 -> 233984 bytes
 lib/bootstrap/4.0/fsi.xml                          |  1379 -
 .../signed/3.0/.NETPortable/FSharp.Core.dll        |   Bin 0 -> 1105368 bytes
 lib/bootstrap/signed/3.0/v2.0/FSharp.Core.dll      |   Bin 0 -> 931800 bytes
 lib/bootstrap/signed/3.0/v4.0/FSharp.Core.dll      |   Bin 0 -> 1121752 bytes
 src/FSharpSource.targets                           |   398 +-
 .../v5.0/FSharpSource.Silverlight.Common.targets   |   643 +
 src/absil/ilreflect.fs                             |     9 +-
 src/absil/ilsupp.fs                                |    55 +-
 src/absil/ilwrite.fs                               |     2 +-
 src/all-vs2010.sln                                 |    85 +
 src/assemblyinfo/assemblyinfo.FSharp.Build.dll.fs  |     5 +-
 ...nfo.FSharp.Compiler.Interactive.Settings.dll.fs |     8 +-
 ...semblyinfo.FSharp.Compiler.Server.Shared.dll.fs |    10 +-
 ...assemblyinfo.FSharp.Compiler.Silverlight.dll.fs |     5 +-
 .../assemblyinfo.FSharp.Compiler.dll.fs            |     9 +-
 src/assemblyinfo/assemblyinfo.FSharp.Core.dll.fs   |     5 +-
 ... assemblyinfo.FSharp.Data.TypeProviders.dll.fs} |    13 +-
 src/fsharp-build.proj                              |    12 +
 src/fsharp-compiler-build.proj                     |     8 +-
 src/fsharp-library-build.proj                      |     1 +
 src/fsharp-library-unittests-build.proj            |     2 +-
 src/fsharp/FSComp.txt                              |     6 +-
 .../FSharp.Build-proto/FSharp.Build-proto.fsproj   |    16 +-
 src/fsharp/FSharp.Build-proto/Makefile.in          |    12 +-
 .../Microsoft.FSharp-proto.targets                 |   246 +
 .../CreateFSharpManifestResourceName.fs            |    35 +-
 src/fsharp/FSharp.Build/FSharp.Build.fsproj        |    33 +-
 src/fsharp/FSharp.Build/Fsc.fs                     |    31 +-
 src/fsharp/FSharp.Build/Makefile.in                |    16 +-
 src/fsharp/FSharp.Build/Microsoft.FSharp.Targets   |   262 +
 src/fsharp/FSharp.Build/Microsoft.FSharp.targets   |   285 +-
 src/fsharp/FSharp.Build/subst.exe                  |   Bin 941568 -> 0 bytes
 src/fsharp/FSharp.Build/subst.fsx                  |    14 -
 .../FSharp.Compiler-proto.fsproj                   |    21 +-
 src/fsharp/FSharp.Compiler-proto/Makefile.in       |    61 +-
 .../FSharp.Compiler.Interactive.Settings.fsproj    |    28 +-
 .../Makefile.in                                    |    17 +-
 .../FSharp.Compiler.Server.Shared.fsproj           |    23 +-
 .../FSharp.Compiler.Server.Shared/Makefile.in      |    17 +-
 .../FSharp.Compiler.Silverlight.fsproj             |    15 +-
 src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj  |    14 +-
 src/fsharp/FSharp.Compiler/Makefile.in             |    85 +-
 .../FSharp.Core.Unittests.fsproj                   |    22 +-
 src/fsharp/FSharp.Core/FSharp.Core.fsproj          |    76 +-
 src/fsharp/FSharp.Core/Linq.fs                     |     9 +-
 src/fsharp/FSharp.Core/Makefile.in                 |    45 +-
 src/fsharp/FSharp.Core/control.fs                  |    24 +-
 src/fsharp/FSharp.Core/control.fsi                 |     0
 src/fsharp/FSharp.Core/math/z.fs                   |     4 +
 src/fsharp/FSharp.Core/prim-types.fs               |     3 +
 .../FSharp.Data.TypeProviders.DesignTime.fsproj    |     2 +-
 .../FSharp.Data.TypeProviders.Shared.fsproj        |    50 -
 .../FSharp.Data.TypeProviders.fsproj               |    67 +-
 src/fsharp/FSharp.Data.TypeProviders/Makefile.in   |    51 +
 .../FSharp.Data.TypeProviders/TypeProviders.fs     |    16 +-
 src/fsharp/Fsc-proto/Fsc-proto.fsproj              |     7 +-
 src/fsharp/Fsc-proto/Makefile.in                   |    23 +-
 src/fsharp/Fsc/Fsc.fsproj                          |    15 +-
 src/fsharp/Fsc/Makefile.in                         |    23 +-
 .../{fsi/fsi.exe.config => Fsc/fsc.exe.config}     |    20 +-
 src/fsharp/Makefile.in                             |    42 +-
 src/fsharp/ReferenceResolution.fs                  |    18 +-
 src/fsharp/ReferenceResolution.fsi                 |     0
 src/fsharp/Salsa/Salsa.fsproj                      |     2 +-
 src/fsharp/Salsa/salsa.fs                          |     2 +-
 src/fsharp/ast.fs                                  |     5 +-
 src/fsharp/build.fs                                |    18 +-
 src/fsharp/build.fsi                               |     1 +
 src/fsharp/est.fs                                  |     3 +
 src/fsharp/est.fsi                                 |     4 +
 src/fsharp/fsc.fs                                  |    34 +-
 src/fsharp/fscmain.fs                              |     5 +-
 src/fsharp/fscopts.fs                              |     3 +-
 src/fsharp/fsi/FSIstrings.txt                      |     2 +-
 src/fsharp/fsi/Fsi.fsproj                          |    52 +-
 src/fsharp/fsi/Makefile.in                         |    25 +-
 src/fsharp/fsi/console.fs                          |    62 +-
 src/fsharp/fsi/fsi.exe.config                      |     6 +
 src/fsharp/fsi/fsi.fs                              |   246 +-
 .../{fsi/Fsi.fsproj => fsiAnyCpu/FsiAnyCPU.fsproj} |    73 +-
 src/fsharp/{fsi => fsiAnyCpu}/Makefile.in          |    30 +-
 src/fsharp/{fsi => fsiAnyCpu}/fsiAnyCPU.exe.config |     6 +
 src/fsharp/fsiserver/fsiserver.fs                  |     0
 src/fsharp/ilxgen.fs                               |     1 -
 src/fsharp/policy.2.0.FSharp.Core/Makefile.in      |    29 +
 .../policy.2.0.FSharp.Core.dll.config              |    17 +
 src/fsharp/policy.2.3.FSharp.Core/Makefile.in      |    29 +
 .../policy.2.3.FSharp.Core.dll.config              |    21 +
 src/fsharp/policy.4.0.FSharp.Core/Makefile.in      |    30 +
 .../policy.4.0.FSharp.Core.dll.config              |    11 +
 src/fsharp/policy.4.3.FSharp.Core/Makefile.in      |    30 +
 .../policy.4.3.FSharp.Core.dll.config              |    11 +
 src/fsharp/tainted.fs                              |     8 +-
 src/fsharp/tainted.fsi                             |     6 +
 src/fsharp/targets.make                            |   207 +-
 src/fsharp/unittests/Build.Unittests.fs            |   452 -
 src/fsharp/unittests/General.Unittests.fs          |    67 -
 src/fsharp/unittests/PowerPack.Unittests.fs        |    99 -
 src/fsharp/unittests/TestLib.LanguageService.fs    |     2 +-
 src/fsharp/unittests/TestLib.fs                    |   124 -
 src/fsharp/unittests/Tests.TypeProvidersImpl.fs    |     2 +-
 src/fsharp/unittests/UnitTestUtils.fs              |    44 -
 src/fsharp/unittests/Unittests.dll.config          |    28 -
 src/fsharp/unittests/Unittests.fsproj              |    19 +-
 src/fsharp/vs/IncrementalBuild.fs                  |     2 +-
 src/fsharp/vs/ServiceDeclarations.fs               |     5 +-
 src/fsharp/vs/SimpleServices.fs                    |     2 +
 src/fsharp/vs/service.fs                           |     8 +
 src/source-build-version                           |     1 -
 src/source-build-version-2.3.0.0                   |     1 -
 src/source-build-version-2.3.5.0                   |     1 -
 src/source-build-version-4.3.0.0                   |     1 -
 src/utils/CompilerLocationUtils.fs                 |   147 +-
 tests/hosting/hosted.fsx                           |    44 +
 .../Sample_MonoDevelop_3_2_8_Console.sln           |    20 +
 .../AssemblyInfo.fs                                |    22 +
 .../Sample_MonoDevelop_3_2_8_Console/Program.fs    |    16 +
 .../Sample_MonoDevelop_3_2_8_Console.fsproj        |    45 +
 .../SampleVisualStudio2010FSharpConsoleApp.sln     |    20 +
 .../Program.fs                                     |    22 +
 .../SampleVisualStudio2010FSharpConsoleApp.fsproj  |    56 +
 .../SampleVisualStudio2010FSharpConsoleApp.sln     |    20 +
 .../Program.fs                                     |     8 +
 .../SampleVisualStudio2010FSharpConsoleApp.fsproj  |    60 +
 .../SampleVisualStudio2010FSharpConsoleApp.sln     |    20 +
 .../Program.fs                                     |     6 +
 .../SampleVisualStudio2010FSharpConsoleApp.fsproj  |    60 +
 .../Sample_VS2012_FSharp_ConsoleApp_net40.sln      |    20 +
 .../App.config                                     |    17 +
 .../Program.fs                                     |    31 +
 .../Sample_VS2012_FSharp_ConsoleApp_net40.fsproj   |    64 +
 .../Sample_VS2012_FSharp_ConsoleApp_net45.sln      |    20 +
 .../App.config                                     |    17 +
 .../Program.fs                                     |     8 +
 .../Sample_VS2012_FSharp_ConsoleApp_net45.fsproj   |    63 +
 .../NOTE.txt                                       |     8 +
 .../Sample_VS2012_FSharp_ConsoleApp_net45.sln      |    20 +
 .../App.config                                     |    17 +
 .../Program.fs                                     |     8 +
 .../Sample_VS2012_FSharp_ConsoleApp_net45.fsproj   |    71 +
 .../content.txt                                    |     1 +
 .../obj/Debug/resource.txt                         |     1 +
 .../resource.txt                                   |     1 +
 202 files changed, 5177 insertions(+), 98556 deletions(-)

diff --cc README.md
index 0000000,8a40b2b..6c1ebf9
mode 000000,100644..100644
--- a/README.md
+++ b/README.md
@@@ -1,0 -1,205 +1,209 @@@
+ This is the F# compiler, core library and core tools (open source edition). It uses the Apache 2.0 license.
+ 
+ The `master` branch is for the latest version of F# (currently F# 3.0).
+ 
+ To bootstrap the compiler, binaries built from an earlier version of this project are used.
+ 
+ ## Requirements
+ 
+ Requires mono 2.9 or higher.  Prefer Mono 3.0.
+ 
+ On OSX, requires automake 2.69. To install from [homebrew](http://mxcl.github.com/homebrew):
+ ```
+ brew install automake
+ ```
+ 
+ 
+ ## Building
+ 
+ ### On Linux and other Unix systems:
+ The usual:
+ ```
+ ./autogen.sh
+ make
+ sudo make install
+ ```
+ By default that makes optimized binaries. To make debug, use ```make CONFIG=debug```
+ 
+ 
+ ### On MacOS (OSX)
+ 
+ Use a prefix to your version of Mono:
+ ```
+ ./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current/
+ make
+ sudo make install
+ ```
+ By default that makes optimized binaries. To make debug, use ```make CONFIG=debug```
+ 
+ ### On Windows, using msbuild (e.g.. if .NET is installed) 
+ If you have only VS2012 installed, and not VS2010, you'll need to install the F# 2.0 Runtime (http://www.microsoft.com/en-us/download/details.aspx?id=13450)
+ ```
+ cd src
+ msbuild fsharp-proto-build.proj
 -ngen install ..\lib\proto\4.0\fsc-proto.exe (optional)
++ngen install ..\lib\proto\4.0\fsc-proto.exe
+ msbuild fsharp-library-build.proj /p:Configuration=Release
+ msbuild fsharp-compiler-build.proj /p:Configuration=Release
+ ```
+ You can also build the FSharp.Core for .NET 2.0, Mono 2.1, MonoTouch, Silverlight 5.0, Windows Phone 7.1, Portable Profile47 (net45+sl5+win8), Portable Profile88 (net4+sl4+wp71+win8) and XNA 4.0 for Xbox 360 profiles:
+ ```
+ msbuild fsharp-library-build.proj /p:TargetFramework=net20 /p:Configuration=Release
+ msbuild fsharp-library-build.proj /p:TargetFramework=mono21 /p:Configuration=Release
+ msbuild fsharp-library-build.proj /p:TargetFramework=monotouch /p:Configuration=Release
+ msbuild fsharp-library-build.proj /p:TargetFramework=portable-net45+sl5+win8 /p:Configuration=Release
+ msbuild fsharp-library-build.proj /p:TargetFramework=portable-net4+sl4+wp71+win8 /p:Configuration=Release
++msbuild fsharp-library-build.proj /p:TargetFramework=portable-windows8+net45 /p:Configuration=Release
+ msbuild fsharp-library-build.proj /p:TargetFramework=sl5 /p:Configuration=Release
+ msbuild fsharp-library-build.proj /p:TargetFramework=wp7 /p:Configuration=Release
+ msbuild fsharp-library-build.proj /p:TargetFramework=net40-xna40-xbox360 /p:Configuration=Release
+ ```
+ You can also build the FSharp.Core and FSharp.Compiler.Silverlight.dll for Silverlight 5.0:
+ ```
+ msbuild fsharp-library-build.proj /p:TargetFramework=sl5-compiler  /p:Configuration=Release
+ msbuild fsharp-compiler-build.proj /p:TargetFramework=sl5-compiler /p:Configuration=Release
+ ```
+ Change to ``` /p:Configuration=Debug``` for debug binaries.
+ 
++Change to ``` /p:FSharpCoreBackVersion=3.0``` to build a back version of FSharp.Core.dll with a 
++version number suitable for use when building libaries that have usable with both F# 3.0 and F 3.1 libraries.
++
+ ### On Windows, using xbuild (e.g. if no .NET is installed and only Mono 3.0 is installed):
+ 
+ ```
+ cd src
+ xbuild fsharp-proto-build.proj
+ xbuild fsharp-library-build.proj
+ xbuild fsharp-compiler-build.proj
+ ```
+ 
+ Building using xbuild does not yet lay down a Mono-ready distribution (see src/fsharp/targets.make), so should only
+ be used for private development rather than preparing distributions. 
+ 
+ 
+ ## Strong Names
+ 
+ The FSharp.Core.dll produced is only delay-signed (Mono does not require strong names). 
+ If a strong-name signed FSharp.Core.dll is needed then use the one in 
+ ```
+    lib\bootstrap\signed\3.0\v4.0\FSharp.Core.dll
+ ```
+ 
+ 
+ ## What you get 
+ 
+ Once built the main compiler binaries go in 
+     lib/release/4.0
+ 
+ There are versions of FSharp.Core for .NET 2.0, MonoAndroid, MonoTouch (Mono profile 2.1) in 
+      lib/release/2.0
+      lib/release/2.1
+      lib/release/2.1monotouch
+ 
+ On 'make install' the binaries etc. go in the prefix, e.g. 
+ 
+    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/2.0/FSharp.Core.dll
+    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/2.1/FSharp.Core.dll
+    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.0/fsc.exe
+    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.0/FSharp.Compiler.dll
+    ...
+    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/fsc.exe
+    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/FSharp.Compiler.dll
+    ...
+    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/gac/.../FSharp.Compiler.dll
+    /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/gac/.../FSharp.Compiler.dll
+    ...
+ 
+ plus some files for xbuild support 
+ 
+     /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/Microsoft\ F#/v4.0/*
+     /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/Microsoft\ SDKs/F#/3.0/Framework/*
+ 
+ (these names are the canonical names for Microsoft.FSharp.Targets used by project files coming from Visual Studio)
+ 
+ plus scripts
+ 
+    /usr/bin/fsharpc   (F# compiler)
+    /usr/bin/fsharpi   (F# Interactive)
+ 
+ ## Development notes
+ 
+ ###Continuous Integration Build 
+ 
+ We have a CI build set up with the JetBrains/Teamcity server as part of the F# community projects there:
+ 
+ http://teamcity.codebetter.com/project.html?projectId=project61&tab=projectOverview
+ 
+ @forki controls access. Right now this builds both a Mono 'make' install  and a Windows 'cd src; msbuild fsharp-build.proj' build.  No binaries are saved from  the build, it is just for sanity checking.
+ 
+ 
+ ###Editing the Compiler with Visual Studio or MonoDevelop
+ 
+ Open `all-vs2012.sln`, and edit in modes Debug or Release. The compiler takes a good while to compile and that
+ can be a bit invasive to the work flow, so it's normally better to do the actual compilation from 
+ the command line, see above.
+ 
+ The F# support in MonoDevelop uses an in-process background compiler. On the Mac this causes pausing garbage
+ collections to kick in which makes editing the compiler in MonoDevelop awkward.
+ 
+ ### Building F# Core Unit Tests for .NET 4.x (optional)
+ 
+ This uses the proto compiler to build the unit tests that check some parts of `FSharp.Core.dll` and `FSharp.Compiler.dll`. There is also another set of tests under `tests\fsharp`.
+ 
+ ```
+ msbuild fsharp-library-unittests-build.proj /p:TargetFramework=net40
+ ```
+ 
+ *Note: You must have NUnit installed to build the unit tests.*
+ 
+ 
+ 
+ ### Validation and Use
+ 
+ Here are some simple tests to validate what you have built by checking `fsi.exe` (F# Interactive) starts up:
+ 
+ ```
+ lib\debug\4.0\fsi.exe
+ 1 + 1;;
+ \#q;;
+ lib\debug\4.0\fsi.exe /help
+ lib\debug\4.0\fsc.exe /help
+ echo printfn "hello world" > hello.fs
+ lib\debug\4.0\fsc.exe hello.fs
+ hello.exe
+ ```
+ 
+ ### Running Compiler tests (on Windows)
+ 
+ There are language tests under `tests\fsharp\core`. The test apparatus is primitive and unfortunately uses batch files. You can run these on Windows using:
+ 
+ ```
+ cd ..\tests\fsharp\core
+ ..\..\build-and-run-all-installed-ilx-configs.bat results.log
+ ```
+ 
+ The results file will contain one entry for each test directory, plus any reported errors.
+ 
+ ```
+ tests\fsharp\core
+ tests\fsharp\core\queriesCustomQueryOps
+ tests\fsharp\core\queriesLeafExpressionConvert
+ tests\fsharp\core\queriesNullableOperators
+ tests\fsharp\core\queriesOverIEnumerable
+ ...
+ ```
+ 
+ Some tests for LINQ queries require SQL Server be installed. A failing test will look like this:
+ 
+ ```
+ ERRORLEVEL=1: in tests\fsharp\core\csfromfs\build.bat
+ ```
+ 
+ You can then go to the relevant directory and run `build.bat` and `run.bat`.
+ 
+ 
+ ## History 
+ 
+ F# compiler sources dropped by Microsoft are available from [fsharppowerpack.codeplex.com](http://fsharppowerpack.codeplex.com).
+ 
+ Uses bootstrapping libraries, tools and F# compiler. The `lib/bootstrap/X.0` directories contain mono-built libraries, compiler and tools that can be used to bootstrap a build. You can also supply your own via the `--with-bootstrap` option.
+ 
diff --cc lib/bootstrap/4.0/Microsoft.FSharp.targets
index 849be62,0000000..c7dffe5
mode 100644,000000..100644
--- a/lib/bootstrap/4.0/Microsoft.FSharp.targets
+++ b/lib/bootstrap/4.0/Microsoft.FSharp.targets
@@@ -1,194 -1,0 +1,262 @@@
 +<!--
 +***********************************************************************************************
 +Microsoft.FSharp.targets
 +
 +WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
 +          created a backup copy.  Incorrect changes to this file will make it
 +          impossible to load or build your projects from the command-line or the IDE.
 +
 +This file defines the steps in the standard build process specific for F# .NET projects.
 +For example, it contains the step that actually calls the F# compiler.  The remainder
 +of the build process is defined in Microsoft.Common.targets, which is imported by 
 +this file.
 +
 +Copyright (C) Microsoft Corporation. Apache 2.0 License.
 +***********************************************************************************************
 +-->
 +
 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +
-     <UsingTask TaskName="Fsc" AssemblyFile="FSharp.Build.dll"/>
-     <UsingTask TaskName="CreateFSharpManifestResourceName" AssemblyFile="FSharp.Build.dll"/>
- 
- 
-     <PropertyGroup>
-         <!-- FSharpTargetsDir is the directory where the targets file lives -->
-         <FSharpTargetsDir Condition="'$(FSharpTargetsDir)'==''">$(MSBuildExtensionsPath32)\FSharp\1.0\</FSharpTargetsDir>
-         <!-- FSharpTargetsFullPath is the full path (dir + filename) of the targets file -->
-         <FSharpTargetsFullPath Condition="'$(FSharpTargetsDir)'!=''">$(FSharpTargetsDir)\Microsoft.FSharp.targets</FSharpTargetsFullPath>
-         <MSBuildAllProjects>$(MSBuildAllProjects);$(FSharpTargetsFullPath)</MSBuildAllProjects>
-         <DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension>
-         <Language>F#</Language>
-         <Tailcalls Condition="'$(Tailcalls)'==''">$(Optimize)</Tailcalls>
-         <!-- Visual studio requires a non-empty RootNamespace value for "Add New Item" to work. -->
-         <RootNamespace Condition="'$(RootNamespace)'==''">RootNamespace</RootNamespace>
-     </PropertyGroup>
- 
-     <!--
++
++  <UsingTask TaskName="Fsc" AssemblyFile="FSharp.Build.dll" Condition="Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll')" />
++  <UsingTask TaskName="CreateFSharpManifestResourceName" AssemblyFile="FSharp.Build.dll" Condition="Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll')" />
++
++  <!-- The next two are for when the ToolsVersion is 3.5, i.e. we're referencing .NET 2.0 -->
++  <UsingTask TaskName="Fsc" AssemblyFile="$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll" Condition="!Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll') AND Exists('$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll')" />
++  <UsingTask TaskName="CreateFSharpManifestResourceName" AssemblyFile="$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll" Condition="!Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll') AND Exists('$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll')" />
++
++
++
++
++  <PropertyGroup>
++    <ImportByWildcardBeforeMicrosoftFSharpTargets Condition="'$(ImportByWildcardBeforeMicrosoftFSharpTargets)' == ''">true</ImportByWildcardBeforeMicrosoftFSharpTargets>
++    <ImportByWildcardAfterMicrosoftFSharpTargets Condition="'$(ImportByWildcardAfterMicrosoftFSharpTargets)' == ''">true</ImportByWildcardAfterMicrosoftFSharpTargets>
++  </PropertyGroup>
++
++  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore')"/>
++
++  <PropertyGroup>
++    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
++    <DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension>
++    <Language>F#</Language>
++    <TargetRuntime>Managed</TargetRuntime>
++    <Tailcalls Condition="'$(Tailcalls)'==''">$(Optimize)</Tailcalls>
++    <FrameworkRegistryBase Condition="'$(TargetFrameworkIdentifier)'=='Silverlight'">Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>
++    <!-- Visual studio requires a non-empty RootNamespace value for "Add New Item" to work. -->
++    <RootNamespace Condition="'$(RootNamespace)'==''">RootNamespace</RootNamespace>
++    <Actual32Bit Condition="'$(TargetFrameworkVersion)'=='v2.0' or '$(TargetFrameworkVersion)'=='v3.0' or '$(TargetFrameworkVersion)'=='v3.5' or '$(TargetFrameworkVersion)'=='v4.0'">false</Actual32Bit>
++    <Actual32Bit Condition="!('$(TargetFrameworkVersion)'=='v2.0' or '$(TargetFrameworkVersion)'=='v3.0' or '$(TargetFrameworkVersion)'=='v3.5' or '$(TargetFrameworkVersion)'=='v4.0')">$(Prefer32Bit)</Actual32Bit>
++  </PropertyGroup>
++
++  <!--
 +      The CreateManifestResourceNames target create the manifest resource names from the .RESX
 +      files.
 +      
 +          [IN]
 +          @(EmbeddedResource) - The list of EmbeddedResource items that have been pre-processed to add metadata about resource type
 +                                Expected Metadata "Type" can either be "Resx" or "Non-Resx"
 +
 +          [OUT]
 +          @(EmbeddedResource) - EmbeddedResource items with metadata         
 +          
 +      For F# applications the transformation is like:
 +
 +          Resources1.resx => Resources1 => Build into main assembly
 +          SubFolder\Resources1.resx => SubFolder.Resources1 => Build into main assembly
 +          Resources1.fr.resx => Resources1.fr => Build into satellite assembly
 +          Resources1.notaculture.resx => Resources1.notaculture => Build into main assembly
 +
 +      For other project systems, this transformation may be different.
 +      -->
-     <PropertyGroup>
-         <CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
-     </PropertyGroup>
-     <Target
-         Name="CreateManifestResourceNames"
-         Condition="'@(EmbeddedResource)' != ''"
-         DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"
++  <PropertyGroup>
++    <CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
++  </PropertyGroup>
++
++  <PropertyGroup>
++    <UsingXBuild>false</UsingXBuild>
++    <UsingXBuild Condition="Exists('$(MSBuildExtensionsPath32)\..\4.0\Mono.Posix.dll')">true</UsingXBuild>
++  </PropertyGroup>
++
++  
++  <Target
++    Name="CreateManifestResourceNames"
++    Condition="'@(EmbeddedResource)' != ''"
++    DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"
 +    >
++    <ItemGroup>
++      <_Temporary Remove="@(_Temporary)" />
++    </ItemGroup>
++
++  <!-- START XBUILD -->
++
++  <!-- This is the implementation of CreateManifestResourceNames which is compatible with the way -->
++  <!-- xbuild processes resource names -->
 +
-         <ItemGroup>
-             <_Temporary Remove="@(_Temporary)" />
-         </ItemGroup>
++    <CreateFSharpManifestResourceName 
++         Condition="'@(ResxWithNoCulture)' != '' AND '$(UsingXBuild)' == 'true'"
++	 ResourceFiles="@(ResxWithNoCulture)" RootNamespace="$(RootNamespace)">
++      <Output TaskParameter = "ManifestResourceNames" ItemName = "ManifestResourceWithNoCultureName" />
++    </CreateFSharpManifestResourceName>
 +
-         <!-- Create manifest names for culture and non-culture Resx files, and for non-culture Non-Resx resources -->
-         <CreateFSharpManifestResourceName
-             ResourceFiles="@(EmbeddedResource)"
-             RootNamespace="$(RootNamespace)"
-             Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and ('%(EmbeddedResource.WithCulture)' == 'false' or '%(EmbeddedResource.Type)' == 'Resx')">
++    <CreateFSharpManifestResourceName 
++         Condition="'@(NonResxWithNoCulture)' != '' AND '$(UsingXBuild)' == 'true'"
++	 ResourceFiles="@(NonResxWithNoCulture)" RootNamespace="$(RootNamespace)">
++      <Output TaskParameter = "ManifestResourceNames" ItemName = "ManifestNonResxWithNoCulture" />
++    </CreateFSharpManifestResourceName>
 +
-             <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
++    <CreateFSharpManifestResourceName 
++         Condition="'@(ResxWithCulture)' != '' AND '$(UsingXBuild)' == 'true'"
++         ResourceFiles="@(ResxWithCulture)" RootNamespace="$(RootNamespace)">
++      <Output TaskParameter = "ManifestResourceNames" ItemName = "ManifestResourceWithCultureName" />
++    </CreateFSharpManifestResourceName>
 +
-         </CreateFSharpManifestResourceName>
++    <CreateFSharpManifestResourceName 
++         Condition="'@(NonResxWithCulture)' != '' AND '$(UsingXBuild)' == 'true'"
++         ResourceFiles="@(NonResxWithCulture)" RootNamespace="$(RootNamespace)">
++      <Output TaskParameter = "ManifestResourceNames" ItemName = "ManifestNonResxWithCulture" />
++    </CreateFSharpManifestResourceName>
 +
-         <!-- Create manifest names for all culture non-resx resources -->
-         <CreateFSharpManifestResourceName
-             ResourceFiles="@(EmbeddedResource)"
-             RootNamespace="$(RootNamespace)"
-             PrependCultureAsDirectory="false"
-             Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx'">
++  <!-- END XBUILD -->
 +
-             <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
 +
-         </CreateFSharpManifestResourceName>
++  <!-- START MSBUILD -->
++
++  <!-- This is the implementation of CreateManifestResourceNames which is compatible with the way -->
++  <!-- msbuild processes resource names -->
++
++    <CreateFSharpManifestResourceName
++          ResourceFiles="@(EmbeddedResource)"
++          RootNamespace="$(RootNamespace)"
++          Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and ('%(EmbeddedResource.WithCulture)' == 'false' or '%(EmbeddedResource.Type)' == 'Resx') AND '$(UsingXBuild)' == 'false'">
++
++      <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
++
++    </CreateFSharpManifestResourceName>
++
++    <CreateFSharpManifestResourceName
++          ResourceFiles="@(EmbeddedResource)"
++          RootNamespace="$(RootNamespace)"
++          PrependCultureAsDirectory="false"
++          Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx' AND '$(UsingXBuild)' == 'false'">
++
++      <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
++
++    </CreateFSharpManifestResourceName>
++
++  <!-- END MSBUILD -->
 +
-         <ItemGroup>
-             <EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
-             <EmbeddedResource Include="@(_Temporary)" />
-             <_Temporary Remove="@(_Temporary)" />
-         </ItemGroup>
-     </Target>
 +
 +    <ItemGroup>
-         <DocFileItem Include="$(DocumentationFile)" Condition="'$(DocumentationFile)'!=''"/>
++      <EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
++      <EmbeddedResource Include="@(_Temporary)" />
++      <_Temporary Remove="@(_Temporary)" />
 +    </ItemGroup>
 +
-     <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true' and '$(PdbFile)' != ''">
-         <_DebugSymbolsIntermediatePathTemporary Include="$(PdbFile)"/>
-         <!-- Add any missing .pdb extension, as the compiler does -->
-         <_DebugSymbolsIntermediatePath Include="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/>
-     </ItemGroup>
++  </Target>
++
++  <ItemGroup>
++    <DocFileItem Include="$(DocumentationFile)" Condition="'$(DocumentationFile)'!=''"/>
++  </ItemGroup>
++
++  <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true' and '$(PdbFile)' != ''">
++    <_DebugSymbolsIntermediatePathTemporary Include="$(PdbFile)"/>
++    <!-- Add any missing .pdb extension, as the compiler does -->
++    <_DebugSymbolsIntermediatePath Include="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/>
++  </ItemGroup>
 +
-     <PropertyGroup>
-         <CoreCompileDependsOn>_ComputeNonExistentFileProperty</CoreCompileDependsOn>
-     </PropertyGroup>
++  <PropertyGroup>
++    <CoreCompileDependsOn></CoreCompileDependsOn>
++  </PropertyGroup>
 +
-     <Target
-         Name="CoreCompile"
-         Inputs="$(MSBuildAllProjects);
++  <Target
++      Name="CoreCompile"
++      Inputs="$(MSBuildAllProjects);
 +                @(CompileBefore);
 +                @(Compile);                               
 +                @(CompileAfter);
 +                @(_CoreCompileResourceInputs);
++                @(ManifestNonResxWithNoCultureOnDisk);
 +                $(ApplicationIcon);
 +                $(AssemblyOriginatorKeyFile);
 +                @(ReferencePath);
 +                @(CompiledLicenseFile);
 +                @(EmbeddedDocumentation); 
 +                $(Win32Resource);
 +                $(Win32Manifest);
 +                @(CustomAdditionalCompileInputs);
 +                $(VersionFile);
 +                $(KeyOriginatorFile)"
-         Outputs="@(DocFileItem);
++      Outputs="@(DocFileItem);
 +                 @(IntermediateAssembly);
 +                 @(_DebugSymbolsIntermediatePath);                 
 +                 $(NonExistentFile);
 +                 @(CustomAdditionalCompileOutputs)"
-         DependsOnTargets="$(CoreCompileDependsOn)"
++      DependsOnTargets="$(CoreCompileDependsOn)"
 +    >
 +
-         <!-- See bug 6053
++    <!-- See bug 6053
 +        <Error  
 +            Condition="'$(SilverlightVersion)' != '' and !(Exists('$(ProgramFiles)\Microsoft F#\Silverlight\Libraries\Client\$(SilverlightVersion)\FSharp.Core.dll'))"
 +            Text="F# runtime for Silverlight version $(SilverlightVersion) is not installed. Please go to http://go.microsoft.com/fwlink/?LinkId=177463 to download and install matching F# runtime"
 +          />
 +          -->
 +
-         <Warning
-             Condition="'$(Win32ResourceFile)' != '' "
-             Text="The property <Win32ResourceFile> has been renamed to <Win32Resource>. Update your project file to ensure that the correct value is passed via the --win32res option to the F# compiler."
++    <Warning
++        Condition="'$(Win32ResourceFile)' != '' "
++        Text="The property <Win32ResourceFile> has been renamed to <Win32Resource>. Update your project file to ensure that the correct value is passed via the --win32res option to the F# compiler."
 +        />
 +
-         <!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler -->
-         <Fsc  Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
-               BaseAddress="$(BaseAddress)"
-               CodePage="$(CodePage)"
-               DebugSymbols="$(DebugSymbols)"
-               DebugType="$(DebugType)"
-               DefineConstants="$(DefineConstants)"
-               DisabledWarnings="$(NoWarn)"
-               DocumentationFile="$(DocumentationFile)"
-               GenerateInterfaceFile="$(GenerateInterfaceFile)"
-               KeyFile="$(KeyOriginatorFile)"
-               LCID="$(LCID)"
-               NoFramework="true"
-               Optimize="$(Optimize)"
-               OtherFlags="$(OtherFlags)"
-               OutputAssembly="@(IntermediateAssembly)"
-               PdbFile="$(PdbFile)"
-               Platform="$(PlatformTarget)"
-               References="@(ReferencePath)"
-               ReferencePath="$(ReferencePath)"
-               Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile);@(AdditionalEmbeddedResource)"
-               Sources="@(CompileBefore);@(Compile);@(CompileAfter)"
-               Tailcalls="$(Tailcalls)"
-               TargetType="$(OutputType)"
-               ToolExe="$(FscToolExe)"
-               ToolPath="$(FscToolPath)"
-               TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
-               Utf8Output="$(Utf8Output)"
-               VersionFile="$(VersionFile)"
-               VisualStudioStyleErrors="$(VisualStudioStyleErrors)"
-               WarningLevel="$(WarningLevel)"
-               WarningsAsErrors="$(WarningsAsErrors)"
-               Win32ManifestFile="$(Win32Manifest)"
-               Win32ResourceFile="$(Win32Resource)"
++    <!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler -->
++    <Fsc  Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
++          BaseAddress="$(BaseAddress)"
++          CodePage="$(CodePage)"
++          DebugSymbols="$(DebugSymbols)"
++          DebugType="$(DebugType)"
++          DefineConstants="$(DefineConstants)"
++          DisabledWarnings="$(NoWarn)"
++          DocumentationFile="$(DocumentationFile)"
++          GenerateInterfaceFile="$(GenerateInterfaceFile)"
++          KeyFile="$(KeyOriginatorFile)"
++          LCID="$(LCID)"
++          NoFramework="true"
++          Optimize="$(Optimize)"
++          OtherFlags="$(OtherFlags)"
++          OutputAssembly="@(IntermediateAssembly)"
++          PdbFile="$(PdbFile)"
++          Platform="$(PlatformTarget)"
++          References="@(ReferencePath)"
++          ReferencePath="$(ReferencePath)"
++          Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile);@(AdditionalEmbeddedResource)"
++          Sources="@(CompileBefore);@(Compile);@(CompileAfter)"
++          Tailcalls="$(Tailcalls)"
++          TargetType="$(OutputType)"
++          ToolExe="$(FscToolExe)"
++          ToolPath="$(FscToolPath)"
++          TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
++          Utf8Output="$(Utf8Output)"
++          ValidateTypeProviders="$(ValidateTypeProviders)"
++          VersionFile="$(VersionFile)"
++          VisualStudioStyleErrors="$(VisualStudioStyleErrors)"
++          WarningLevel="$(WarningLevel)"
++          WarningsAsErrors="$(WarningsAsErrors)"
++          Win32ManifestFile="$(Win32Manifest)"
++          Win32ResourceFile="$(Win32Resource)"
 +                />
 +
-         <ItemGroup>
-             <_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
-         </ItemGroup>
++     <!-- These parameters are supported by F# 3.0 but not yet supported by the F# open source edition:
++              Prefer32Bit="$(Actual32Bit)" 
++              SubsystemVersion="$(SubsystemVersion)"
++              HighEntropyVA="$(HighEntropyVA)" -->
++
++  <ItemGroup>
++      <_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
++    </ItemGroup>
++
++  </Target>
 +
-     </Target>
++  <Import Project="$(MSBuildBinPath)\Microsoft.Common.targets"/>
 +
-     <Import Project="$(MSBuildBinPath)\Microsoft.Common.targets"/>
++  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')"/>
 +
 +</Project>
 +
diff --cc src/FSharpSource.targets
index 8272b3f,3412b07..71d799d
--- a/src/FSharpSource.targets
+++ b/src/FSharpSource.targets
@@@ -18,25 -17,23 +17,39 @@@
      <DebugSymbols>true</DebugSymbols>
    </PropertyGroup>
  
-   <!-- For .NET 2.0 and 4.0, we use the version in 'source-build-version', initially 2.9.999 -->
-   <!-- For Mono 2.0 and 4.0, we use the same versions as VS2012 (see strong naming below) -->
-   <!-- -->
-   <!-- However FSharp.Core must always use the same version and name as VS, with delay signing, see below  -->
-   <PropertyGroup Condition="'$(AssemblyName)' != 'FSharp.Core'">
-     <VersionFile>$(FSharpSourcesRoot)\source-build-version</VersionFile>
-     <VersionFile Condition="'$(TargetFramework)' == 'mono20'">$(FSharpSourcesRoot)\source-build-version-2.3.0.0</VersionFile>
-     <VersionFile Condition="'$(TargetFramework)' == 'mono40'">$(FSharpSourcesRoot)\source-build-version-4.3.0.0</VersionFile>
-   </PropertyGroup>
- 
-   <PropertyGroup Condition="'$(AssemblyName)' == 'FSharp.Core'">
-     <VersionFile>$(FSharpSourcesRoot)\source-build-version</VersionFile>
-     <VersionFile Condition="'$(TargetFramework)' == 'net20' OR '$(TargetFramework)' == 'mono20'">$(FSharpSourcesRoot)\source-build-version-2.3.0.0</VersionFile>
-     <VersionFile Condition="'$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'mono40'">$(FSharpSourcesRoot)\source-build-version-4.3.0.0</VersionFile>
+   <!-- We use the same versions as VS2012 (see strong naming below) -->
+   <PropertyGroup>
 -    <VersionFile>$(FSharpSourcesRoot)\source-build-version</VersionFile>
 -    <VersionFile Condition="'$(TargetFramework)' == 'net20'">$(FSharpSourcesRoot)\source-build-version-2.3.0.0</VersionFile>
 -    <VersionFile Condition="'$(TargetFramework)' == 'net40'">$(FSharpSourcesRoot)\source-build-version-4.3.0.0</VersionFile>
 -    <VersionFile Condition="'$(TargetFramework)' == 'portable-net4+sl4+wp71+win8'">$(FSharpSourcesRoot)\source-build-version-2.3.5.0</VersionFile>
 -    <VersionFile Condition="'$(TargetFramework)' == 'portable-net45+sl5+win8'">$(FSharpSourcesRoot)\source-build-version-2.3.5.0</VersionFile>    
 -<!--
++    <!-- Compute the assembly version numbers to use -->
++    <AssemblyVersion>2.9.9.999</AssemblyVersion>
++    <!-- This is the primary framework, used to run the compiler itself -->
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'net40'">4.3.1.0</AssemblyVersion>
++    <!-- These correspond to the frameworks supported by Microsoft -->
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'net20'">2.3.1.0</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'portable-net45+sl5+win8' ">2.3.5.1</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'portable-net4+sl4+wp71+win8' ">2.3.6.1</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'mono21' ">2.3.98.1</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'monotouch' ">2.3.99.1</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'portable-windows8+net45'">3.3.1.0</AssemblyVersion>
++
++    <!-- These are simulations of previous versions of FSharp.Core for F# 3.0, useable to support the 'build a library compatible with a back version of F#' multi-targeting option supported by some IDEs -->
++    <!-- The actual libraries will contain additional functionality related to F# 3.1 etc. but that doesn't matter - the version number will be right which is what counts -->
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'net20' AND '$(FSharpCoreBackVersion)' == '3.0' ">2.3.0.0</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'net40' AND '$(FSharpCoreBackVersion)' == '3.0' ">4.3.0.0</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'portable-net45+sl5+win8' AND '$(FSharpCoreBackVersion)' == '3.0' ">2.3.5.0</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'portable-net4+sl4+wp71+win8' AND '$(FSharpCoreBackVersion)' == '3.0' ">2.3.6.0</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'mono21' AND '$(FSharpCoreBackVersion)' == '3.0' ">2.3.98.0</AssemblyVersion>
++    <AssemblyVersion Condition="'$(AssemblyName)' == 'FSharp.Core' AND '$(TargetFramework)' == 'monotouch' AND '$(FSharpCoreBackVersion)' == '3.0' ">2.3.99.0</AssemblyVersion>
++    <!-- FSharp.Core using System.Runtime -->
++    <OtherFlags>$(OtherFlags) --version:$(AssemblyVersion)</OtherFlags>
++    <!--
+ Some other NuGET monikers to support in the future, see http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#Package_Conventions
+ 
 -    <VersionFile Condition="'$(TargetFramework)' == 'portable-windows8+net45'">$(FSharpSourcesRoot)\source-build-version-2.3.6.0</VersionFile>
+     <VersionFile Condition="'$(TargetFramework)' == 'windows8'">$(FSharpSourcesRoot)\source-build-version-2.3.7.0</VersionFile>
+     <VersionFile Condition="'$(TargetFramework)' == 'windowsphone8'">$(FSharpSourcesRoot)\source-build-version-2.3.8.0</VersionFile>
+ -->
    </PropertyGroup>
  
-   <!-- For .NET 2.0 and 4.0, we use test-signed binaries, apart from FSharp.Core. We do this because there's no point creating Microsoft-named binaries. -->
-   <!-- -->
-   <!-- For Mono 2.0 and 4.0, we sign with the Microsoft key and use delay-signing. -->
+   <!-- We sign FSharp.Core with the Microsoft key and use delay-signing. -->
    <!-- These can then be signed with the special mono.snk (we don't do this as part of this build, -->
    <!-- but it can be done manually later, e.g. on the target machine). This is how the Mono team build the binaries -->
    <!-- at github.com/fsharp/fsharp and how they are shipped with Mono -->
@@@ -426,12 -607,61 +623,66 @@@
      <OtherFlags>$(OtherFlags) --simpleresolution -r:"C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\mscorlib.dll"  -r:"C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.dll"</OtherFlags>
    </PropertyGroup>
  
+   <!-- XNA 4.0 Xbox360 -->
+   <PropertyGroup Condition="'$(TargetFramework)'=='net40-xna40-xbox360'">
+   <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+   <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
+   <XnaPlatform>Xbox 360</XnaPlatform>
+   <DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_DEBUG_PROXIES</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_EXIT</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_IOBSERVABLE</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_WEB_CLIENT</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_WEB_REQUESTS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_CHAR_PARSE</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_DEFAULT_DEPENDENCY_TYPE</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_SIMPLE_SECURITY_PERMISSIONS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_TRUNCATE</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_CULTURE_INFO_ARGS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_REFLECTION_MODULE_HANDLES</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_OPERATION_CANCELLED</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_TO_LOWER_INVARIANT</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_BASED_ARRAYS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_DOUBLE_BIT_CONVERTER</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_BINARY_SERIALIZATION</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_ASCII_ENCODING</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_DEFAULT_ENCODING</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_FILE_OPTIONS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_NONBLOCK_IO</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_COMMAND_LINE_ARGS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_ENVIRONMENT</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_PROCESS_START</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_APP_DOMAINS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_PROCESS_DIAGNOSTICS</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_STRUCTURAL_EQUALITY</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_LAZY</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_TUPLE</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_REFLECTION_EMIT</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_BIGINT</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_MONITOR_REPORTS_LOCKTAKEN</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_TPL_PARALLEL</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_TASK</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_CUSTOMATTRIBUTEDATA</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_ATLEAST_PORTABLE</DefineConstants>
+   <DefineConstants>$(DefineConstants);FX_NO_CANCELLATIONTOKEN_CLASSES</DefineConstants>
+   <Tailcalls>false</Tailcalls>
+   </PropertyGroup>
  
++  <!-- If building an FSharp.Core for F# 3.0, put it in the 3.0 directory -->
++  <PropertyGroup>
++    <TargetFrameworkOutputDirectory Condition="'$(FSharpCoreBackVersion)' != '3.0'">$(TargetFrameworkOutputDirectory)\$(FSharpCoreBackVersion)</TargetFrameworkOutputDirectory>
++  </PropertyGroup>
++
+   <!-- Always qualify the IntermediateOutputPath by the TargetFramework if any exists -->
+   <PropertyGroup>
+     <IntermediateOutputPath>obj\$(ConfigurationOutputDirectory)\$(TargetFrameworkOutputDirectory)\</IntermediateOutputPath>
+   </PropertyGroup>
  
-   <!-- Build with LKG compiler (location is determined by Microsoft.FSharp.targets). The output compiler has suffix "-proto" -->
-   <PropertyGroup Condition=" '$(BuildWith)' == 'LKG' And '$(ProjectLanguage)' == 'FSharp' ">
+   <!-- Build with LKG compiler (location is determined by Microsoft.FSharp.Targets). The output compiler has suffix "-proto" -->
+   <PropertyGroup Condition=" '$(BuildWith)' == 'LKG'">
      <FsBuildSuffix>-proto</FsBuildSuffix>
-     <OutputPath>$(FSharpSourcesRoot)\..\$(Configuration)\$(protoCLIDir)\bin</OutputPath>
+     <OutputPath>$(FSharpSourcesRoot)\..\lib\$(ConfigurationOutputDirectory)\$(TargetFrameworkOutputDirectory)</OutputPath>
    </PropertyGroup>
  
    <!-- Build with prototype compiler (location is given by settings below). The output is the final bootstrapped compiler -->
@@@ -489,30 -712,18 +733,10 @@@
              Text="Configuration '$(Configuration)' is not one of the supported configurations: Debug, Release, Proto"
              Condition="'$(Configuration)'!='Release' and '$(Configuration)'!='Debug' and '$(Configuration)'!='Proto'"/>
      <Error
-             Text="TargetFramework '$(TargetFramework)' is not one of the supported configurations: 'empty', net20, net40, mono20, mono40, sl3-wp, sl5, sl5-compiler"
 -            Text="TargetFramework '$(TargetFramework)' is not one of the supported configurations: 'empty', net20, net40, mono21, monotouch, wp7, sl5, sl5-compiler, portable-net4+sl4+wp71+win8, portable-net45+sl5+win8"
--            Condition="! ('$(TargetFramework)' == 'net40' or 
--                          '$(TargetFramework)' == 'net20' or 
-                           '$(TargetFramework)' == 'mono40' or 
-                           '$(TargetFramework)' == 'mono20' or 
 -                          '$(TargetFramework)' == 'mono21' or 
 -                          '$(TargetFramework)' == 'monotouch' or 
--                          '$(TargetFramework)' == 'sl5' or 
--                          '$(TargetFramework)' == 'sl5-compiler' or 
-                           '$(TargetFramework)' == 'sl3-wp')"/>
-   </Target>
 -                          '$(TargetFramework)' == 'wp7' or 
 -                          '$(TargetFramework)' == 'portable-net4+sl4+wp71+win8' or
 -                          '$(TargetFramework)' == 'portable-net45+sl5+win8' or                          
 -                          '$(TargetFramework)' == 'net40-xna40-xbox360') "/>
++            Text="Portable profile '$(TargetFramework)' is not yet supported"
++            Condition="'$(TargetFramework)' == 'portable-windows8+net45'"/>
 +
-   <!-- This build step copies files to the output folder while replacing build variables in the text of
-              those file. -->
-   <Target
-           Name="CustomCopyLocalFiles"
-           Inputs="@(CustomCopyLocal)"
-           Outputs="@(CustomCopyLocal->'$(OutDir)%(TargetFilename)')"
-           Condition="'$(targetCLIDir)'!='Silverlight/4.0/'"
-                 >
-     <Exec Command="$(FSharpSourcesRoot)\fsharp\FSharp.Build\subst.exe {LkgVersion} $(LkgVersion) {BuildSuffix} "$(FsBuildSuffix)" {FSharpTargetsDir} unused "%(CustomCopyLocal.FullPath)" > $(OutDir)%(CustomCopyLocal.TargetFilename)  "/>
-     <!-- Make sure it will get cleaned  -->
-     <CreateItem Include="$(OutDir)%(CustomCopyLocal.TargetFilename)">
-       <Output TaskParameter="Include" ItemName="FileWrites"/>
-     </CreateItem>
    </Target>
  
-   <Import Project="..\lkg\FSharp-$(LkgVersion)\bin\FSharp.SRGen.targets" />
+   <Import Project="$(LkgPath)\..\2.0\FSharp.SRGen.targets" />
  </Project>
diff --cc src/absil/ilwrite.fs
index 67174d8,4ec4ebe..df626d4
--- a/src/absil/ilwrite.fs
+++ b/src/absil/ilwrite.fs
@@@ -4614,7 -4612,7 +4614,7 @@@ type options 
  
  
  let WriteILBinary outfile (args: options) modul noDebugData =
-     ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, args.dumpDebugInfo) modul noDebugData)
 -    ignore (writeBinaryAndReportMappings (outfile, args.mscorlib, args.pdbfile, args.signer, args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, args.dumpDebugInfo) modul (noDebugData, true))
++   ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, args.dumpDebugInfo) modul noDebugData)
  
  
  
diff --cc src/fsharp/FSComp.txt
index 54adc40,86f36a2..67a535f
--- a/src/fsharp/FSComp.txt
+++ b/src/fsharp/FSComp.txt
@@@ -1323,9 -1328,3 +1323,9 @@@ descriptionUnavailable,"(description un
  3171,tcGeneratedTypesShouldBeInternalOrPrivate,"The provided types generated by this use of a type provider may not be used from other F# assemblies and should be marked internal or private. Consider using 'type internal TypeName = ...' or 'type private TypeName = ...'."
  3172,chkGetterAndSetterHaveSamePropertyType,"A property's getter and setter must have the same type. Property '%s' has getter of type '%s' but setter of type '%s'."
  3173,tcRuntimeSuppliedMethodCannotBeUsedInUserCode,"Array method '%s' is supplied by the runtime and cannot be directly used in code. For operations with array elements consider using family of GetArray/SetArray functions from LanguagePrimitives.IntrinsicFunctions module."
 +3174,tcUnionCaseConstructorDoesNotHaveFieldWithGivenName,"Union case/exception '%s' does not have field named '%s'."
 +3175,tcUnionCaseFieldCannotBeUsedMoreThanOnce,"Union case/exception field '%s' cannot be used more than once."
 +3176,tcFieldNameIsUsedModeThanOnce,"Named field '%s' is used more than once."
 +3176,tcFieldNameConflictsWithGeneratedNameForAnonymousField,"Named field '%s' conflicts with autogenerated name for anonymous field."
 +3177,tastConstantExpressionOverflow,"This literal expression or attribute argument results in an arithmetic overflow."
- 3178,tcIllegalStructTypeForConstantExpression,"This is not valid literal expression. The [<Literal>] attribute will be ignored."
++3178,tcIllegalStructTypeForConstantExpression,"This is not valid literal expression. The [<Literal>] attribute will be ignored."
diff --cc src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj
index 0db59ec,860d623..845246b
--- a/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj
+++ b/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj
@@@ -1,7 -1,17 +1,7 @@@
  <?xml version="1.0" encoding="utf-8"?>
 -<!--
 -# Copyright (c) 2002-2011 Microsoft Corporation. 
 -#
 -# 
 -# 
 -# 
 -#
 -#
 -# You must not remove this notice, or any other, from this software.
 --->
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
-     <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
      <Configuration Condition=" '$(Configuration)' == '' ">Proto</Configuration>
      <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    </PropertyGroup>
@@@ -13,11 -23,13 +13,14 @@@
      <DefineConstants>BUILDING_WITH_LKG;$(DefineConstants)</DefineConstants>
      <BuildWith>LKG</BuildWith>
      <ProjectGuid>{D8BC791F-C1A9-49DC-9432-0F3090537555}</ProjectGuid>
 +    <TargetFrameworkVersion Condition="'$(TargetFramework)'=='net20'">v3.5</TargetFrameworkVersion>
+     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    </PropertyGroup>
+   <!-- MonoDevelop likes these here to recognise the configurations -->
+   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " />
+   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' " />
    <ItemGroup>
  	  <FsSrGen Include="..\FSharp.Build\FSBuild.txt">
- 		  <Link>FSBuild.txt</Link>
  	  </FsSrGen>
      <Compile Include="..\..\utils\CompilerLocationUtils.fs">
        <Link>CompilerLocationUtils.fs</Link>
@@@ -43,10 -55,8 +46,9 @@@
      <Reference Include="mscorlib" />
      <Reference Include="FSharp.Core" />
      <Reference Include="System" />
 +    <Reference Include="System.Numerics" Condition="'$(TargetFramework)'=='net40'" />
+     <Reference Include="System.Numerics" Condition="'$(TargetFramework)' == 'net40'" />
      <Reference Include="Microsoft.Build.Engine" />
-     <Reference Include="Microsoft.Build.Utilities.v3.5" Condition="'$(TargetFramework)' == 'net20'" />
-     <Reference Include="Microsoft.Build.Tasks.v3.5" Condition="'$(TargetFramework)' == 'net20'" />
      <Reference Include="Microsoft.Build" Condition="'$(TargetFramework)'=='net40'" />
      <Reference Include="Microsoft.Build.Framework" Condition="'$(TargetFramework)'=='net40'" />
      <Reference Include="Microsoft.Build.Utilities.v4.0" Condition="'$(TargetFramework)'=='net40'" />
diff --cc src/fsharp/FSharp.Build/FSharp.Build.fsproj
index cfb7c97,d427e97..7b1ed52
mode 100755,100644..100644
--- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj
+++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj
@@@ -1,7 -1,20 +1,10 @@@
  <?xml version="1.0" encoding="utf-8"?>
 -<!--
 -# Copyright (c) 2002-2011 Microsoft Corporation. 
 -#
 -# 
 -# 
 -# 
 -#
 -#
 -# You must not remove this notice, or any other, from this software.
 --->
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
-     <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
+     <ProductVersion>10.0.0</ProductVersion>
+     <SchemaVersion>2.0</SchemaVersion>
+     <UsePartialTypes>False</UsePartialTypes>
    </PropertyGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
    <PropertyGroup>
@@@ -10,13 -23,15 +13,16 @@@
      <OutputType>Library</OutputType>
      <AssemblyName>FSharp.Build</AssemblyName>
      <AllowCrossTargeting>true</AllowCrossTargeting>
 +    <TargetFrameworkVersion Condition="'$(TargetFramework)'=='net20'">v3.5</TargetFrameworkVersion>
      <ProjectGuid>{702A7979-BCF9-4C41-853E-3ADFC9897890}</ProjectGuid>
    </PropertyGroup>
+   <!-- MonoDevelop likes these here to recognise the configurations -->
+   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " />
+   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' " />
    <ItemGroup>
-       <FsSrGen Include="FSBuild.txt">
-         <Link>FSBuild.txt</Link>
-       </FsSrGen>
+     <FsSrGen Include="FSBuild.txt">
+       <Link>FSBuild.txt</Link>
+     </FsSrGen>
      <Compile Include="..\..\assemblyinfo\assemblyinfo.FSharp.Build.dll.fs">
        <Link>assemblyinfo.FSharp.Build.dll.fs</Link>
      </Compile>
@@@ -37,19 -49,15 +40,25 @@@
    <ItemGroup>
      <Reference Include="mscorlib" />
      <Reference Include="System" />
- 
      <Reference Include="Microsoft.Build.Engine" />
      <Reference Include="Microsoft.Build.Framework" />
 +    <Reference Include="Microsoft.Build.Utilities.v3.5" Condition="'$(TargetFramework)'=='net20'" />
 +    <Reference Include="Microsoft.Build.Tasks.v3.5" Condition="'$(TargetFramework)'=='net20'" />
 +
 +    <Reference Include="Microsoft.Build" Condition="'$(TargetFramework)'=='net40'"  />
 +    <Reference Include="Microsoft.Build.Utilities.v4.0" Condition="'$(TargetFramework)'=='net40'" />
 +    <Reference Include="Microsoft.Build.Tasks.v4.0" Condition="'$(TargetFramework)'=='net40'" />
 +    <ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
 +		  <Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
 +		  <Name>FSharp.Core</Name>
 +	  </ProjectReference>
+     <Reference Include="Microsoft.Build" Condition="'$(TargetFramework)'=='net40'" />
+     <Reference Include="Microsoft.Build.Utilities.v4.0" Condition="'$(TargetFramework)'=='net40'" />
+     <Reference Include="Microsoft.Build.Tasks.v4.0" Condition="'$(TargetFramework)'=='net40'" />
+     <ProjectReference Include="..\FSharp.Core\FSharp.Core.fsproj">
+       <Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
+       <Name>FSharp.Core</Name>
+     </ProjectReference>
    </ItemGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
- </Project>
+ </Project>
diff --cc src/fsharp/FSharp.Build/Microsoft.FSharp.targets
index a5d2d8e,0000000..88453cb
mode 100755,000000..100755
--- a/src/fsharp/FSharp.Build/Microsoft.FSharp.targets
+++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.targets
@@@ -1,195 -1,0 +1,262 @@@
 +<!--
 +***********************************************************************************************
- Microsoft.FSharp.targets
++Microsoft.FSharp.Targets
 +
 +WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
 +          created a backup copy.  Incorrect changes to this file will make it
 +          impossible to load or build your projects from the command-line or the IDE.
 +
 +This file defines the steps in the standard build process specific for F# .NET projects.
 +For example, it contains the step that actually calls the F# compiler.  The remainder
 +of the build process is defined in Microsoft.Common.targets, which is imported by 
 +this file.
 +
 +Copyright (C) Microsoft Corporation. Apache 2.0 License.
 +***********************************************************************************************
 +-->
 +
 +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 +
-     <UsingTask TaskName="Fsc" AssemblyFile="FSharp.Build{BuildSuffix}.dll"/>
-     <UsingTask TaskName="CreateFSharpManifestResourceName" AssemblyFile="FSharp.Build{BuildSuffix}.dll"/>
- 
- 
-     <PropertyGroup>
-         <!-- FSharpTargetsDir is the directory where the targets file lives -->
-         <FSharpTargetsDir Condition="'$(FSharpTargetsDir)'==''">{FSharpTargetsDir}</FSharpTargetsDir>
-         <!-- FSharpTargetsFullPath is the full path (dir + filename) of the targets file -->
-         <FSharpTargetsFullPath Condition="'$(FSharpTargetsDir)'!=''">$(FSharpTargetsDir)\Microsoft.FSharp{BuildSuffix}.targets</FSharpTargetsFullPath>
-         <MSBuildAllProjects>$(MSBuildAllProjects);$(FSharpTargetsFullPath)</MSBuildAllProjects>
-         <DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension>
-         <Language>F#</Language>
-         <Tailcalls Condition="'$(Tailcalls)'==''">$(Optimize)</Tailcalls>
-         <FrameworkRegistryBase Condition="'$(TargetFrameworkIdentifier)'=='Silverlight'">Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>
-         <!-- Visual studio requires a non-empty RootNamespace value for "Add New Item" to work. -->
-         <RootNamespace Condition="'$(RootNamespace)'==''">RootNamespace</RootNamespace>
-     </PropertyGroup>
- 
-     <!--
++
++  <UsingTask TaskName="Fsc" AssemblyFile="FSharp.Build.dll" Condition="Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll')" />
++  <UsingTask TaskName="CreateFSharpManifestResourceName" AssemblyFile="FSharp.Build.dll" Condition="Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll')" />
++
++  <!-- The next two are for when the ToolsVersion is 3.5, i.e. we're referencing .NET 2.0 -->
++  <UsingTask TaskName="Fsc" AssemblyFile="$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll" Condition="!Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll') AND Exists('$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll')" />
++  <UsingTask TaskName="CreateFSharpManifestResourceName" AssemblyFile="$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll" Condition="!Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll') AND Exists('$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll')" />
++
++
++
++
++  <PropertyGroup>
++    <ImportByWildcardBeforeMicrosoftFSharpTargets Condition="'$(ImportByWildcardBeforeMicrosoftFSharpTargets)' == ''">true</ImportByWildcardBeforeMicrosoftFSharpTargets>
++    <ImportByWildcardAfterMicrosoftFSharpTargets Condition="'$(ImportByWildcardAfterMicrosoftFSharpTargets)' == ''">true</ImportByWildcardAfterMicrosoftFSharpTargets>
++  </PropertyGroup>
++
++  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore')"/>
++
++  <PropertyGroup>
++    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
++    <DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension>
++    <Language>F#</Language>
++    <TargetRuntime>Managed</TargetRuntime>
++    <Tailcalls Condition="'$(Tailcalls)'==''">$(Optimize)</Tailcalls>
++    <FrameworkRegistryBase Condition="'$(TargetFrameworkIdentifier)'=='Silverlight'">Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>
++    <!-- Visual studio requires a non-empty RootNamespace value for "Add New Item" to work. -->
++    <RootNamespace Condition="'$(RootNamespace)'==''">RootNamespace</RootNamespace>
++    <Actual32Bit Condition="'$(TargetFrameworkVersion)'=='v2.0' or '$(TargetFrameworkVersion)'=='v3.0' or '$(TargetFrameworkVersion)'=='v3.5' or '$(TargetFrameworkVersion)'=='v4.0'">false</Actual32Bit>
++    <Actual32Bit Condition="!('$(TargetFrameworkVersion)'=='v2.0' or '$(TargetFrameworkVersion)'=='v3.0' or '$(TargetFrameworkVersion)'=='v3.5' or '$(TargetFrameworkVersion)'=='v4.0')">$(Prefer32Bit)</Actual32Bit>
++  </PropertyGroup>
++
++  <!--
 +      The CreateManifestResourceNames target create the manifest resource names from the .RESX
 +      files.
 +      
 +          [IN]
 +          @(EmbeddedResource) - The list of EmbeddedResource items that have been pre-processed to add metadata about resource type
 +                                Expected Metadata "Type" can either be "Resx" or "Non-Resx"
 +
 +          [OUT]
 +          @(EmbeddedResource) - EmbeddedResource items with metadata         
 +          
 +      For F# applications the transformation is like:
 +
 +          Resources1.resx => Resources1 => Build into main assembly
 +          SubFolder\Resources1.resx => SubFolder.Resources1 => Build into main assembly
 +          Resources1.fr.resx => Resources1.fr => Build into satellite assembly
 +          Resources1.notaculture.resx => Resources1.notaculture => Build into main assembly
 +
 +      For other project systems, this transformation may be different.
 +      -->
-     <PropertyGroup>
-         <CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
-     </PropertyGroup>
-     <Target
-         Name="CreateManifestResourceNames"
-         Condition="'@(EmbeddedResource)' != ''"
-         DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"
++  <PropertyGroup>
++    <CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
++  </PropertyGroup>
++
++  <PropertyGroup>
++    <UsingXBuild>false</UsingXBuild>
++    <UsingXBuild Condition="Exists('$(MSBuildExtensionsPath32)\..\4.0\Mono.Posix.dll')">true</UsingXBuild>
++  </PropertyGroup>
++
++  
++  <Target
++    Name="CreateManifestResourceNames"
++    Condition="'@(EmbeddedResource)' != ''"
++    DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"
 +    >
++    <ItemGroup>
++      <_Temporary Remove="@(_Temporary)" />
++    </ItemGroup>
++
++  <!-- START XBUILD -->
++
++  <!-- This is the implementation of CreateManifestResourceNames which is compatible with the way -->
++  <!-- xbuild processes resource names -->
 +
-         <ItemGroup>
-             <_Temporary Remove="@(_Temporary)" />
-         </ItemGroup>
++    <CreateFSharpManifestResourceName 
++         Condition="'@(ResxWithNoCulture)' != '' AND '$(UsingXBuild)' == 'true'"
++	 ResourceFiles="@(ResxWithNoCulture)" RootNamespace="$(RootNamespace)">
++      <Output TaskParameter = "ManifestResourceNames" ItemName = "ManifestResourceWithNoCultureName" />
++    </CreateFSharpManifestResourceName>
 +
-         <!-- Create manifest names for culture and non-culture Resx files, and for non-culture Non-Resx resources -->
-         <CreateFSharpManifestResourceName
-             ResourceFiles="@(EmbeddedResource)"
-             RootNamespace="$(RootNamespace)"
-             Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and ('%(EmbeddedResource.WithCulture)' == 'false' or '%(EmbeddedResource.Type)' == 'Resx')">
++    <CreateFSharpManifestResourceName 
++         Condition="'@(NonResxWithNoCulture)' != '' AND '$(UsingXBuild)' == 'true'"
++	 ResourceFiles="@(NonResxWithNoCulture)" RootNamespace="$(RootNamespace)">
++      <Output TaskParameter = "ManifestResourceNames" ItemName = "ManifestNonResxWithNoCulture" />
++    </CreateFSharpManifestResourceName>
 +
-             <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
++    <CreateFSharpManifestResourceName 
++         Condition="'@(ResxWithCulture)' != '' AND '$(UsingXBuild)' == 'true'"
++         ResourceFiles="@(ResxWithCulture)" RootNamespace="$(RootNamespace)">
++      <Output TaskParameter = "ManifestResourceNames" ItemName = "ManifestResourceWithCultureName" />
++    </CreateFSharpManifestResourceName>
 +
-         </CreateFSharpManifestResourceName>
++    <CreateFSharpManifestResourceName 
++         Condition="'@(NonResxWithCulture)' != '' AND '$(UsingXBuild)' == 'true'"
++         ResourceFiles="@(NonResxWithCulture)" RootNamespace="$(RootNamespace)">
++      <Output TaskParameter = "ManifestResourceNames" ItemName = "ManifestNonResxWithCulture" />
++    </CreateFSharpManifestResourceName>
 +
-         <!-- Create manifest names for all culture non-resx resources -->
-         <CreateFSharpManifestResourceName
-             ResourceFiles="@(EmbeddedResource)"
-             RootNamespace="$(RootNamespace)"
-             PrependCultureAsDirectory="false"
-             Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx'">
++  <!-- END XBUILD -->
 +
-             <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
 +
-         </CreateFSharpManifestResourceName>
++  <!-- START MSBUILD -->
++
++  <!-- This is the implementation of CreateManifestResourceNames which is compatible with the way -->
++  <!-- msbuild processes resource names -->
++
++    <CreateFSharpManifestResourceName
++          ResourceFiles="@(EmbeddedResource)"
++          RootNamespace="$(RootNamespace)"
++          Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and ('%(EmbeddedResource.WithCulture)' == 'false' or '%(EmbeddedResource.Type)' == 'Resx') AND '$(UsingXBuild)' == 'false'">
++
++      <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
++
++    </CreateFSharpManifestResourceName>
++
++    <CreateFSharpManifestResourceName
++          ResourceFiles="@(EmbeddedResource)"
++          RootNamespace="$(RootNamespace)"
++          PrependCultureAsDirectory="false"
++          Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx' AND '$(UsingXBuild)' == 'false'">
++
++      <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
++
++    </CreateFSharpManifestResourceName>
++
++  <!-- END MSBUILD -->
 +
-         <ItemGroup>
-             <EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
-             <EmbeddedResource Include="@(_Temporary)" />
-             <_Temporary Remove="@(_Temporary)" />
-         </ItemGroup>
-     </Target>
 +
 +    <ItemGroup>
-         <DocFileItem Include="$(DocumentationFile)" Condition="'$(DocumentationFile)'!=''"/>
++      <EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
++      <EmbeddedResource Include="@(_Temporary)" />
++      <_Temporary Remove="@(_Temporary)" />
 +    </ItemGroup>
 +
-     <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true' and '$(PdbFile)' != ''">
-         <_DebugSymbolsIntermediatePathTemporary Include="$(PdbFile)"/>
-         <!-- Add any missing .pdb extension, as the compiler does -->
-         <_DebugSymbolsIntermediatePath Include="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/>
-     </ItemGroup>
++  </Target>
++
++  <ItemGroup>
++    <DocFileItem Include="$(DocumentationFile)" Condition="'$(DocumentationFile)'!=''"/>
++  </ItemGroup>
 +
-     <PropertyGroup>
-         <CoreCompileDependsOn>_ComputeNonExistentFileProperty</CoreCompileDependsOn>
-     </PropertyGroup>
++  <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true' and '$(PdbFile)' != ''">
++    <_DebugSymbolsIntermediatePathTemporary Include="$(PdbFile)"/>
++    <!-- Add any missing .pdb extension, as the compiler does -->
++    <_DebugSymbolsIntermediatePath Include="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/>
++  </ItemGroup>
 +
-     <Target
-         Name="CoreCompile"
-         Inputs="$(MSBuildAllProjects);
++  <PropertyGroup>
++    <CoreCompileDependsOn></CoreCompileDependsOn>
++  </PropertyGroup>
++
++  <Target
++      Name="CoreCompile"
++      Inputs="$(MSBuildAllProjects);
 +                @(CompileBefore);
 +                @(Compile);                               
 +                @(CompileAfter);
 +                @(_CoreCompileResourceInputs);
++                @(ManifestNonResxWithNoCultureOnDisk);
 +                $(ApplicationIcon);
 +                $(AssemblyOriginatorKeyFile);
 +                @(ReferencePath);
 +                @(CompiledLicenseFile);
 +                @(EmbeddedDocumentation); 
 +                $(Win32Resource);
 +                $(Win32Manifest);
 +                @(CustomAdditionalCompileInputs);
 +                $(VersionFile);
 +                $(KeyOriginatorFile)"
-         Outputs="@(DocFileItem);
++      Outputs="@(DocFileItem);
 +                 @(IntermediateAssembly);
 +                 @(_DebugSymbolsIntermediatePath);                 
 +                 $(NonExistentFile);
 +                 @(CustomAdditionalCompileOutputs)"
-         DependsOnTargets="$(CoreCompileDependsOn)"
++      DependsOnTargets="$(CoreCompileDependsOn)"
 +    >
 +
-         <!-- See bug 6053
++    <!-- See bug 6053
 +        <Error  
 +            Condition="'$(SilverlightVersion)' != '' and !(Exists('$(ProgramFiles)\Microsoft F#\Silverlight\Libraries\Client\$(SilverlightVersion)\FSharp.Core.dll'))"
 +            Text="F# runtime for Silverlight version $(SilverlightVersion) is not installed. Please go to http://go.microsoft.com/fwlink/?LinkId=177463 to download and install matching F# runtime"
 +          />
 +          -->
 +
-         <Warning
-             Condition="'$(Win32ResourceFile)' != '' "
-             Text="The property <Win32ResourceFile> has been renamed to <Win32Resource>. Update your project file to ensure that the correct value is passed via the --win32res option to the F# compiler."
++    <Warning
++        Condition="'$(Win32ResourceFile)' != '' "
++        Text="The property <Win32ResourceFile> has been renamed to <Win32Resource>. Update your project file to ensure that the correct value is passed via the --win32res option to the F# compiler."
 +        />
 +
-         <!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler -->
-         <Fsc  Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
-               BaseAddress="$(BaseAddress)"
-               CodePage="$(CodePage)"
-               DebugSymbols="$(DebugSymbols)"
-               DebugType="$(DebugType)"
-               DefineConstants="$(DefineConstants)"
-               DisabledWarnings="$(NoWarn)"
-               DocumentationFile="$(DocumentationFile)"
-               GenerateInterfaceFile="$(GenerateInterfaceFile)"
-               KeyFile="$(KeyOriginatorFile)"
-               LCID="$(LCID)"
-               NoFramework="true"
-               Optimize="$(Optimize)"
-               OtherFlags="$(OtherFlags)"
-               OutputAssembly="@(IntermediateAssembly)"
-               PdbFile="$(PdbFile)"
-               Platform="$(PlatformTarget)"
-               References="@(ReferencePath)"
-               ReferencePath="$(ReferencePath)"
-               Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile);@(AdditionalEmbeddedResource)"
-               Sources="@(CompileBefore);@(Compile);@(CompileAfter)"
-               Tailcalls="$(Tailcalls)"
-               TargetType="$(OutputType)"
-               ToolExe="$(FscToolExe)"
-               ToolPath="$(FscToolPath)"
-               TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
-               Utf8Output="$(Utf8Output)"
-               ValidateTypeProviders="$(ValidateTypeProviders)"
-               VersionFile="$(VersionFile)"
-               VisualStudioStyleErrors="$(VisualStudioStyleErrors)"
-               WarningLevel="$(WarningLevel)"
-               WarningsAsErrors="$(WarningsAsErrors)"
-               Win32ManifestFile="$(Win32Manifest)"
-               Win32ResourceFile="$(Win32Resource)"
++    <!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler -->
++    <Fsc  Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
++          BaseAddress="$(BaseAddress)"
++          CodePage="$(CodePage)"
++          DebugSymbols="$(DebugSymbols)"
++          DebugType="$(DebugType)"
++          DefineConstants="$(DefineConstants)"
++          DisabledWarnings="$(NoWarn)"
++          DocumentationFile="$(DocumentationFile)"
++          GenerateInterfaceFile="$(GenerateInterfaceFile)"
++          KeyFile="$(KeyOriginatorFile)"
++          LCID="$(LCID)"
++          NoFramework="true"
++          Optimize="$(Optimize)"
++          OtherFlags="$(OtherFlags)"
++          OutputAssembly="@(IntermediateAssembly)"
++          PdbFile="$(PdbFile)"
++          Platform="$(PlatformTarget)"
++          References="@(ReferencePath)"
++          ReferencePath="$(ReferencePath)"
++          Resources="@(ManifestResourceWithNoCulture);@(ManifestNonResxWithNoCultureOnDisk);@(CompiledLicenseFile);@(AdditionalEmbeddedResource)"
++          Sources="@(CompileBefore);@(Compile);@(CompileAfter)"
++          Tailcalls="$(Tailcalls)"
++          TargetType="$(OutputType)"
++          ToolExe="$(FscToolExe)"
++          ToolPath="$(FscToolPath)"
++          TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
++          Utf8Output="$(Utf8Output)"
++          ValidateTypeProviders="$(ValidateTypeProviders)"
++          VersionFile="$(VersionFile)"
++          VisualStudioStyleErrors="$(VisualStudioStyleErrors)"
++          WarningLevel="$(WarningLevel)"
++          WarningsAsErrors="$(WarningsAsErrors)"
++          Win32ManifestFile="$(Win32Manifest)"
++          Win32ResourceFile="$(Win32Resource)"
 +                />
 +
-         <ItemGroup>
-             <_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
-         </ItemGroup>
++     <!-- These parameters are supported by F# 3.0 but not yet supported by the F# open source edition:
++              Prefer32Bit="$(Actual32Bit)" 
++              SubsystemVersion="$(SubsystemVersion)"
++              HighEntropyVA="$(HighEntropyVA)" -->
 +
-     </Target>
++  <ItemGroup>
++      <_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
++    </ItemGroup>
 +
-     <Import Project="$(MSBuildBinPath)\Microsoft.Common.targets"/>
++  </Target>
++
++  <Import Project="$(MSBuildBinPath)\Microsoft.Common.targets"/>
++
++  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')"/>
 +
 +</Project>
++
diff --cc src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj
index 79fa853,93a11b4..9e9ecab
mode 100755,100644..100644
--- a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj
+++ b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj
@@@ -1,7 -1,20 +1,10 @@@
  <?xml version="1.0" encoding="utf-8"?>
 -<!--
 -# Copyright (c) 2002-2011 Microsoft Corporation. 
 -#
 -# 
 -# 
 -# 
 -#
 -#
 -# You must not remove this notice, or any other, from this software.
 --->
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
-     <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
+     <ProductVersion>10.0.0</ProductVersion>
+     <SchemaVersion>2.0</SchemaVersion>
+     <UsePartialTypes>False</UsePartialTypes>
    </PropertyGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
    <PropertyGroup>
diff --cc src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj
index 71637af,1e905ae..b1f0467
mode 100755,100644..100644
--- a/src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj
+++ b/src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj
@@@ -1,7 -1,20 +1,10 @@@
  <?xml version="1.0" encoding="utf-8"?>
 -<!--
 -# Copyright (c) 2002-2011 Microsoft Corporation. 
 -#
 -# 
 -# 
 -# 
 -#
 -#
 -# You must not remove this notice, or any other, from this software.
 --->
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
-     <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
+     <ProductVersion>10.0.0</ProductVersion>
+     <SchemaVersion>2.0</SchemaVersion>
+     <UsePartialTypes>False</UsePartialTypes>
    </PropertyGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
    <PropertyGroup>
diff --cc src/fsharp/FSharp.Compiler.Silverlight/FSharp.Compiler.Silverlight.fsproj
index 9e080e3,0342bc1..a8f5c6d
mode 100755,100644..100644
--- a/src/fsharp/FSharp.Compiler.Silverlight/FSharp.Compiler.Silverlight.fsproj
+++ b/src/fsharp/FSharp.Compiler.Silverlight/FSharp.Compiler.Silverlight.fsproj
@@@ -476,13 -478,8 +479,9 @@@
      <Compile Include="..\vs\SimpleServices.fs">
        <Link>SimpleServices.fs</Link>
      </Compile>
 +-->
    </ItemGroup>
    <ItemGroup>
-     <ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
-       <Project>{5ed79cd6-eda7-4052-972a-053d3e8391b6}</Project>
-       <Name>FSharp.Core</Name>
-     </ProjectReference>
      <Reference Include="mscorlib" />
      <Reference Include="System" />
      <Reference Include="System.Core" />
diff --cc src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj
index 34d4f5b,676bcf8..afa77b9
mode 100755,100644..100644
--- a/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj
+++ b/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj
@@@ -1,7 -1,20 +1,10 @@@
  <?xml version="1.0" encoding="utf-8"?>
 -<!--
 -# Copyright (c) 2002-2011 Microsoft Corporation. 
 -#
 -# 
 -# 
 -# 
 -#
 -#
 -# You must not remove this notice, or any other, from this software.
 --->
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
-     <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
+     <ProductVersion>10.0.0</ProductVersion>
+     <SchemaVersion>2.0</SchemaVersion>
+     <UsePartialTypes>False</UsePartialTypes>
    </PropertyGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
    <PropertyGroup>
@@@ -489,19 -502,14 +495,19 @@@
      <Reference Include="System.Core" />
      <Reference Include="System.Drawing" />
      <Reference Include="System.Windows.Forms" />
-     <Reference Include="System.Runtime.Remoting" />    
+     <Reference Include="System.Runtime.Remoting" />
      <Reference Include="Microsoft.Build.Framework" />
      <Reference Include="Microsoft.Build.Engine" />
 +    <Reference Include="Microsoft.Build.Utilities" Condition="'$(TargetFramework)'=='net20'" />
 +    <Reference Include="Microsoft.Build.Tasks" Condition="'$(TargetFramework)'=='net20'" />
 +
      <Reference Include="ISymWrapper, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition="'$(TargetFramework)'=='net40'" />
      <Reference Include="Microsoft.Build" Condition="'$(TargetFramework)'=='net40'" />
      <Reference Include="Microsoft.Build.Utilities.v4.0" Condition="'$(TargetFramework)'=='net40'" />
      <Reference Include="Microsoft.Build.Tasks.v4.0" Condition="'$(TargetFramework)'=='net40'" />
 +
 +
-     <ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj" >
+     <ProjectReference Include="..\FSharp.Core\FSharp.Core.fsproj">
        <Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
        <Name>FSharp.Core</Name>
      </ProjectReference>
diff --cc src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj
index fab4b65,9eb8be8..072173f
mode 100755,100644..100644
--- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj
+++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj
@@@ -1,8 -1,9 +1,11 @@@
  <?xml version="1.0" encoding="utf-8"?>
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
 +    <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
 +    <ProjectGuid>{88e2d422-6852-46e3-a740-83e391dc7973}</ProjectGuid>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
+     <ProductVersion>10.0.0</ProductVersion>
+     <UsePartialTypes>False</UsePartialTypes>
    </PropertyGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
    <PropertyGroup>
@@@ -11,9 -12,9 +14,8 @@@
      <SchemaVersion>2.0</SchemaVersion>
      <AllowCrossTargeting>true</AllowCrossTargeting>
      <ReferenceVsAssemblies>true</ReferenceVsAssemblies>
 -    <ProjectGuid>{88E2D422-6852-46E3-A740-83E391DC7973}</ProjectGuid>
      <OutputType>Library</OutputType>
      <AssemblyName>FSharp.Core.Unittests</AssemblyName>
-     <TargetFrameworkVersion Condition=" '$(TargetFramework)' == 'net20' ">v3.5</TargetFrameworkVersion>
      <Name>SystematicUnitTests</Name>
      <!-- Prevent compiler from inlining calls to FSharp.Core to improve code coverage accuracy -->
      <Optimize>false</Optimize>
@@@ -38,23 -38,24 +39,34 @@@
      <DefineConstants>TRACE</DefineConstants>
      <ErrorReport>prompt</ErrorReport>
      <WarningLevel>3</WarningLevel>
+     <DebugSymbols>False</DebugSymbols>
    </PropertyGroup>
    <ItemGroup>
 +    <Reference Include="nunit.framework" Condition="'$(TargetFramework)' != 'sl5' AND '$(TargetFramework)' != 'sl5-compiler' AND '$(TargetFramework)' != 'sl3-wp'" />
 +    <Reference Include="NUnitFramework" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl3-wp' OR '$(TargetFramework)' == 'sl5-compiler'" />
 +    <ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
 +      <Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
 +      <Name>FSharp.Core</Name>
 +    </ProjectReference>
+     <Reference Include="nunit.framework" Condition="'$(TargetFramework)' != 'sl5' AND '$(TargetFramework)' != 'sl5-compiler' AND '$(TargetFramework)' != 'wp7'" />
+     <Reference Include="NUnitFramework" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'wp7' OR '$(TargetFramework)' == 'sl5-compiler'" />
      <Reference Include="mscorlib" />
      <Reference Include="System" />
      <Reference Include="System.Numerics" Condition="'$(TargetFramework)' == 'net40'" />
      <Reference Include="System.Core" />
      <Reference Include="System.Net" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl5-compiler' " />
 +    <Reference Include="System.Observable" Condition="'$(TargetFramework)' == 'sl3-wp' " />
 +  </ItemGroup>
 +  <ItemGroup>
 +    <Compile Include="NUnitFrameworkShims.fs" Condition="'$(TargetFramework)' == 'sl3-wp'" />
+     <Reference Include="System.Observable" Condition="'$(TargetFramework)' == 'wp7' " />
+     <ProjectReference Include="..\FSharp.Core\FSharp.Core.fsproj">
+       <Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
+       <Name>FSharp.Core</Name>
+     </ProjectReference>
+   </ItemGroup>
+   <ItemGroup>
+     <Compile Include="NUnitFrameworkShims.fs" Condition="'$(TargetFramework)' == 'wp7'" />
      <Compile Include="LibraryTestFx.fs" />
      <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ArrayModule.fs" />
      <Compile Include="FSharp.Core\Microsoft.FSharp.Collections\ArrayModule2.fs" />
diff --cc src/fsharp/FSharp.Core/FSharp.Core.fsproj
index b3209e9,e758e7b..256a4cf
mode 100755,100644..100644
--- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj
+++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj
@@@ -212,20 -207,17 +207,18 @@@
      <Compile Include="..\..\assemblyinfo\assemblyinfo.FSharp.Core.dll.fs">
        <Link>assemblyinfo.FSharp.Core.dll.fs</Link>
      </Compile>
+     <CustomAdditionalCompileInputs Include="$(FscToolPath)\$(FscToolExe)">
+       <Visible>False</Visible>
+     </CustomAdditionalCompileInputs>
    </ItemGroup>
    <ItemGroup>
-     <Reference Include="mscorlib" />
 -    <Reference Include="mscorlib" Condition="'$(TargetFramework)' != 'wp7' " />
++    <Reference Include="mscorlib" Condition="'$(TargetFramework)' != 'wp7' AND '$(TargetFramework)' != 'portable-windows8+net45' " />
++    <Reference Include="System.Runtime" Condition="'$(TargetFramework)' == 'portable-windows8+net45' " />
      <Reference Include="System" />
-     <Reference Include="System.Numerics" Condition="'$(TargetFramework)' == 'net40' or '$(TargetFramework)'=='mono40'" />
-     <Reference Include="System.Net" Condition="'$(TargetFramework)' == 'sl5' OR 
-                                                '$(TargetFramework)' == 'sl5-compiler' OR 
-                                                '$(TargetFramework)' == 'XNA\5.0' OR 
-                                                '$(TargetFramework)' == 'sl3-wp' "/>
-     <Reference Include="System.Observable" Condition="'$(TargetFramework)' == 'sl3-wp' "/> 
-     <Reference Include="System.Core" Condition="'$(TargetFramework)' == 'sl5' OR 
-                                                '$(TargetFramework)' == 'sl5-compiler' OR 
-                                                '$(TargetFramework)' == 'XNA\5.0' OR 
-                                                '$(TargetFramework)' == 'sl3-wp' "/>
+     <Reference Include="System.Numerics" Condition="'$(TargetFramework)' == 'net40'" />
 -    <Reference Include="System.Net" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl5-compiler' OR '$(TargetFramework)' == 'XNA\5.0' OR '$(TargetFramework)' == 'wp7' OR '$(TargetFramework)' == 'portable-net4+sl4+wp71+win8' OR '$(TargetFramework)' == 'portable-net45+sl5+win8' OR '$(TargetFramework)' == 'net40-xna40-xbox360' " />
++    <Reference Include="System.Net" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl5-compiler' OR '$(TargetFramework)' == 'XNA\5.0' OR '$(TargetFramework)' == 'wp7' OR '$(TargetFramework)' == 'portable-net4+sl4+wp71+win8' OR '$(TargetFramework)' == 'portable-net45+sl5+win8' OR '$(TargetFramework)' == 'net40-xna40-xbox360' OR '$(TargetFramework)' == 'portable-windows8+net45'" />
+     <Reference Include="System.Observable" Condition="'$(TargetFramework)' == 'wp7' " />
 -    <Reference Include="System.Core" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl5-compiler' OR '$(TargetFramework)' == 'XNA\5.0' OR '$(TargetFramework)' == 'wp7' OR '$(TargetFramework)' == 'portable-net4+sl4+wp71+win8' OR '$(TargetFramework)' == 'portable-net45+sl5+win8' OR '$(TargetFramework)' == 'net40-xna40-xbox360' " />
++    <Reference Include="System.Core" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl5-compiler' OR '$(TargetFramework)' == 'XNA\5.0' OR '$(TargetFramework)' == 'wp7' OR '$(TargetFramework)' == 'portable-net4+sl4+wp71+win8' OR '$(TargetFramework)' == 'portable-net45+sl5+win8' OR '$(TargetFramework)' == 'net40-xna40-xbox360' OR '$(TargetFramework)' == 'portable-windows8+net45'" />
    </ItemGroup>
    <!-- References -->
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
diff --cc src/fsharp/FSharp.Core/control.fs
index e8991d3,737c0f5..64b925a
--- a/src/fsharp/FSharp.Core/control.fs
+++ b/src/fsharp/FSharp.Core/control.fs
@@@ -1579,8 -1520,10 +1590,9 @@@ namespace Microsoft.FSharp.Contro
                                          |> unfake
                              )
                              |> ignore
+ #endif
                          // if user has specified timeout different from Timeout.Infinite 
                          // then start another async to track timeout expiration
 -                        // StartWithContinuations already installs trampoline so we can invoke continuation directly
                          if millisecondsTimeout <> Timeout.Infinite then 
                              Async.StartWithContinuations
                                  (
diff --cc src/fsharp/FSharp.Core/control.fsi
index 16e827e,585aa97..16e827e
mode 100755,100644..100644
--- a/src/fsharp/FSharp.Core/control.fsi
+++ b/src/fsharp/FSharp.Core/control.fsi
diff --cc src/fsharp/Fsc-proto/Fsc-proto.fsproj
index c76e639,0c2a899..f55dba8
--- a/src/fsharp/Fsc-proto/Fsc-proto.fsproj
+++ b/src/fsharp/Fsc-proto/Fsc-proto.fsproj
@@@ -1,7 -1,17 +1,7 @@@
  <?xml version="1.0" encoding="utf-8"?>
 -<!--
 -# Copyright (c) 2002-2011 Microsoft Corporation. 
 -#
 -# 
 -# 
 -# 
 -#
 -#
 -# You must not remove this notice, or any other, from this software.
 --->
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
-     <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
      <Configuration Condition=" '$(Configuration)' == '' ">Proto</Configuration>
    </PropertyGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
@@@ -19,8 -29,11 +19,12 @@@
      <ProjectGuid>{9D7C9060-9263-40EB-8FE3-1E4E3C6D941C}</ProjectGuid>
      <AllowCrossTargeting>true</AllowCrossTargeting>
      <OtherFlags>$(OtherFlags) --stackReserveSize:4096000</OtherFlags>
 +    <TargetFrameworkVersion Condition="'$(TargetFramework)'=='net20'">v2.0</TargetFrameworkVersion>
+     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    </PropertyGroup>
+   <!-- MonoDevelop likes these here to recognise the configurations -->
+   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " />
+   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' " />
    <ItemGroup>
      <Compile Include="..\fscmain.fs">
        <Link>fscmain.fs</Link>
@@@ -32,7 -45,7 +36,8 @@@
      <Reference Include="System" />
      <Reference Include="System.Windows.Forms" />
      <Reference Include="System.Runtime.Remoting" />
 +    <Reference Include="System.Numerics" Condition="'$(TargetFramework)'=='net40'" />
+     <Reference Include="System.Numerics" Condition="'$(TargetFramework)' == 'net40'" />
      <ProjectReference Include="..\FSharp.Compiler-proto\FSharp.Compiler-proto.fsproj">
        <Project>{33E0FB8C-93DC-4AD7-9DCD-9FBDA6C2F061}</Project>
        <Name>FSharp.Compiler-proto</Name>
diff --cc src/fsharp/Fsc/Fsc.fsproj
index 829b339,584460c..28bf20d
mode 100755,100644..100644
--- a/src/fsharp/Fsc/Fsc.fsproj
+++ b/src/fsharp/Fsc/Fsc.fsproj
@@@ -1,7 -1,20 +1,10 @@@
  <?xml version="1.0" encoding="utf-8"?>
 -<!--
 -# Copyright (c) 2002-2011 Microsoft Corporation. 
 -#
 -# 
 -# 
 -# 
 -#
 -#
 -# You must not remove this notice, or any other, from this software.
 --->
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
-     <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
+     <ProductVersion>10.0.0</ProductVersion>
+     <SchemaVersion>2.0</SchemaVersion>
+     <UsePartialTypes>False</UsePartialTypes>
    </PropertyGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
    <PropertyGroup>
@@@ -17,9 -30,11 +20,12 @@@
      <AssemblyName>fsc</AssemblyName>
      <DefineConstants>EXTENSIONTYPING;COMPILER;$(DefineConstants)</DefineConstants>
      <AllowCrossTargeting>true</AllowCrossTargeting>
 +    <TargetFrameworkVersion Condition="'$(TargetFramework)'=='net20'">v2.0</TargetFrameworkVersion>
      <OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
    </PropertyGroup>
+   <!-- MonoDevelop likes these here to recognise the configurations -->
+   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " />
+   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' " />
    <ItemGroup>
      <Compile Include="..\..\assemblyinfo\assemblyinfo.fsc.exe.fs">
        <Link>assemblyinfo.fsc.exe.fs</Link>
diff --cc src/fsharp/Makefile.in
index ea32033,68552fe..6ddf24d
--- a/src/fsharp/Makefile.in
+++ b/src/fsharp/Makefile.in
@@@ -8,13 -19,38 +19,40 @@@ do-final install
  	$(MAKE) -C Fsc $@
  	$(MAKE) -C FSharp.Compiler.Interactive.Settings $@
  	$(MAKE) -C FSharp.Compiler.Server.Shared $@
+ 	$(MAKE) -C FSharp.Data.TypeProviders $@
  	$(MAKE) -C fsi $@
+ 	$(MAKE) -C fsiAnyCpu $@
+ 	$(MAKE) -C policy.2.0.FSharp.Core $@
+ 	$(MAKE) -C policy.4.0.FSharp.Core $@
+ 	$(MAKE) -C policy.2.3.FSharp.Core $@
++	$(MAKE) -C policy.3.3.FSharp.Core $@
+ 	$(MAKE) -C policy.4.3.FSharp.Core $@
  
- install:
+ clean clean-2-0 clean-4-0:
+ 	$(MAKE) -C FSharp.Build-proto $@
+ 	$(MAKE) -C FSharp.Compiler-proto $@
+ 	$(MAKE) -C Fsc-proto $@
  	$(MAKE) -C FSharp.Core $@
  	$(MAKE) -C FSharp.Build $@
  	$(MAKE) -C FSharp.Compiler $@
  	$(MAKE) -C Fsc $@
  	$(MAKE) -C FSharp.Compiler.Interactive.Settings $@
  	$(MAKE) -C FSharp.Compiler.Server.Shared $@
+ 	$(MAKE) -C FSharp.Data.TypeProviders $@
  	$(MAKE) -C fsi $@
+ 	$(MAKE) -C fsiAnyCpu $@
+ 	$(MAKE) -C policy.2.0.FSharp.Core $@
+ 	$(MAKE) -C policy.4.0.FSharp.Core $@
+ 	$(MAKE) -C policy.2.3.FSharp.Core $@
++	$(MAKE) -C policy.3.3.FSharp.Core $@
+ 	$(MAKE) -C policy.4.3.FSharp.Core $@
+ 
+ clean-2-1 do-2-1:
+ 	$(MAKE) -C FSharp.Core $@
+ 
+ install-2-1: do-2-1
+ 	$(MAKE) -C FSharp.Core $@
+ 
+ 
+ 
+ 
diff --cc src/fsharp/ReferenceResolution.fs
index a2ea037,88fd4c9..08f02f4
mode 100755,100644..100644
--- a/src/fsharp/ReferenceResolution.fs
+++ b/src/fsharp/ReferenceResolution.fs
@@@ -27,10 -27,9 +27,11 @@@ module internal MSBuildResolver 
      type ResolutionEnvironment = CompileTimeLike | RuntimeLike | DesigntimeLike
      
  #if SILVERLIGHT
 +    let HighestInstalledNetFrameworkVersionMajorMinor() =
 +        4,"v5.0"
  #else
      open System
+     open System.Reflection
      open Microsoft.Build.Tasks
      open Microsoft.Build.Utilities
      open Microsoft.Build.Framework
diff --cc src/fsharp/ReferenceResolution.fsi
index 2110873,58aea2b..2110873
mode 100755,100644..100644
--- a/src/fsharp/ReferenceResolution.fsi
+++ b/src/fsharp/ReferenceResolution.fsi
diff --cc src/fsharp/ast.fs
index 5a36f04,f5f8ae3..0a8c529
mode 100755,100644..100644
--- a/src/fsharp/ast.fs
+++ b/src/fsharp/ast.fs
diff --cc src/fsharp/build.fs
index c7a3b74,bb359e2..51a8d22
--- a/src/fsharp/build.fs
+++ b/src/fsharp/build.fs
@@@ -1417,35 -1391,20 +1418,39 @@@ let CollectErrorOrWarning (implicitIncl
                              Filename.fullpath implicitIncludeDir file
                         else 
                              SanitizeFileName file implicitIncludeDir
 -            match errorStyle with
 -              | ErrorStyle.EmacsErrors   -> Printf.bprintf os "File \"%s\", line %d, characters %d-%d: " (file.Replace("\\","/")) m.StartLine m.StartColumn m.EndColumn
 -              // We're adjusting the columns here to be 1-based - both for parity with C# and for MSBuild, which assumes 1-based columns for error output
 -              | ErrorStyle.DefaultErrors -> Printf.bprintf os "%s(%d,%d): " (file.Replace('/',System.IO.Path.DirectorySeparatorChar)) m.StartLine (m.StartColumn + 1)
 -              | ErrorStyle.GccErrors     -> Printf.bprintf os "%s:%d:%d: " (file.Replace('/',System.IO.Path.DirectorySeparatorChar)) m.StartLine (m.StartColumn + 1)
 -              // We may also want to change TestErrors to be 1-based
 -              | ErrorStyle.TestErrors    -> Printf.bprintf os "%s(%d,%d-%d,%d): " (file.Replace("/","\\")) m.StartLine (m.StartColumn + 1) m.EndLine (m.EndColumn + 1) 
 -              // Here, we want the complete range information so Project Systems can generate proper squiggles
 -              | ErrorStyle.VSErrors      -> 
 -                    // Show prefix only for real files. Otherise, we just want a truncated error like:
 -                    //      parse error FS0031 : blah blah
 -                    if m<>range0 && m<>rangeStartup && m<>rangeCmdArgs then 
 -                        Printf.bprintf os "%s(%d,%d,%d,%d): " (file.Replace("/","\\")) m.StartLine (m.StartColumn + 1) m.EndLine (m.EndColumn + 1)
 -
 +            let text, m, file = 
 +                match errorStyle with
 +                  | ErrorStyle.EmacsErrors   -> 
 +                    let file = file.Replace("\\","/")
 +                    (sprintf "File \"%s\", line %d, characters %d-%d: " file m.StartLine m.StartColumn m.EndColumn), m, file
 +
 +                  // We're adjusting the columns here to be 1-based - both for parity with C# and for MSBuild, which assumes 1-based columns for error output
 +                  | ErrorStyle.DefaultErrors -> 
 +                    let file = file.Replace('/',System.IO.Path.DirectorySeparatorChar)
 +                    let m = mkRange m.FileName (mkPos m.StartLine (m.StartColumn + 1)) m.End
 +                    (sprintf "%s(%d,%d): " file m.StartLine m.StartColumn), m, file
 +
 +                  // We may also want to change TestErrors to be 1-based
 +                  | ErrorStyle.TestErrors    -> 
 +                    let file = file.Replace("/","\\")
 +                    let m = mkRange m.FileName (mkPos m.StartLine (m.StartColumn + 1)) (mkPos m.EndLine (m.EndColumn + 1) )
 +                    sprintf "%s(%d,%d-%d,%d): " file m.StartLine m.StartColumn m.EndLine m.EndColumn, m, file
 +
++                  | ErrorStyle.GccErrors     -> 
++                    let file = file.Replace('/',System.IO.Path.DirectorySeparatorChar)
++                    sprintf "%s:%d:%d: " file m.StartLine (m.StartColumn + 1), m, file
++
 +                  // Here, we want the complete range information so Project Systems can generate proper squiggles
 +                  | ErrorStyle.VSErrors      -> 
 +                        // Show prefix only for real files. Otherise, we just want a truncated error like:
 +                        //      parse error FS0031 : blah blah
 +                        if m<>range0 && m<>rangeStartup && m<>rangeCmdArgs then 
 +                            let file = file.Replace("/","\\")
 +                            let m = mkRange m.FileName (mkPos m.StartLine (m.StartColumn + 1)) (mkPos m.EndLine (m.EndColumn + 1) )
 +                            sprintf "%s(%d,%d,%d,%d): " file m.StartLine m.StartColumn m.EndLine m.EndColumn, m, file
 +                        else
 +                            "", m, file
 +            { Range = m; TextRepresentation = text; IsEmpty = false; File = file }
  
      match err.Exception with 
      | ReportedError _ -> 
diff --cc src/fsharp/fsc.fs
index 4128d2a,eecb40e..316cac8
--- a/src/fsharp/fsc.fs
+++ b/src/fsharp/fsc.fs
@@@ -2176,326 -1986,4 +2176,340 @@@ let compile arg 
      |> main3 
      |> main4
  
 -#endif //NO_COMPILER_BACKEND
 +let typecheckAndCompile(argv,bannerAlreadyPrinted,exiter:Exiter, errorLoggerProvider) =
 +    // Don's note: "GC of intermediate data is really, really important here"
 +    use d = new DelayedDisposables()
 +    main0(argv,bannerAlreadyPrinted,exiter, errorLoggerProvider, d)
 +    |> compile
 +
 +let mainCompile (argv,bannerAlreadyPrinted,exiter:Exiter) = 
 +    typecheckAndCompile(argv, bannerAlreadyPrinted, exiter, DefaultLoggerProvider())
 +
 +type CompilationOutput = 
 +    {
 +        Errors : seq<ErrorOrWarning>
 +        Warnings : seq<ErrorOrWarning>
 +    }
 +
 +type InProcCompiler() = 
 +    member this.Compile(argv) = 
 +
 +        let errors = ResizeArray()
 +        let warnings = ResizeArray()
 +
 +        let loggerProvider = {
 +            new ErrorLoggerProvider() with
 +                member log.CreateErrorLoggerThatQuitsAfterMaxErrors(tcConfigBuilder, exiter) = 
 +                    upcast {
 +                        new ErrorLoggerThatQuitsAfterMaxErrors(tcConfigBuilder, exiter, "InProcCompilerErrorLoggerThatQuitsAfterMaxErrors") with
 +                            member this.HandleTooManyErrors(text) = warnings.Add(ErrorOrWarning.Short(false, text))
 +                            member this.HandleIssue(tcConfigBuilder, err, isWarning) = 
 +                                let errs = CollectErrorOrWarning(tcConfigBuilder.implicitIncludeDir, tcConfigBuilder.showFullPaths, tcConfigBuilder.flatErrors, tcConfigBuilder.errorStyle, isWarning, err)
 +                                let container = if isWarning then warnings else errors
 +                                container.AddRange(errs)
 +                    }
 +        }
 +        let exitCode = ref 0
 +        let exiter = {
 +            new Exiter with
 +                member this.Exit n = exitCode := n; raise StopProcessing
 +            }
 +        try 
 +            typecheckAndCompile(argv, false, exiter, loggerProvider)
 +        with 
 +            | StopProcessing -> ()
 +            | ReportedError _  | WrappedError(ReportedError _,_)  ->
 +                exitCode := 1
 +                ()
 +
 +        let output = { Warnings = warnings; Errors = errors}
 +        !exitCode = 0, output
 +
 +/// Collect the output from the stdout and stderr streams, character by character,
 +/// recording the console color used along the way.
- type private OutputCollector() = 
++type OutputCollector() = 
 +    let output = ResizeArray()
 +    let outWriter isOut = 
 +        { new TextWriter() with 
 +              member x.Write(c:char) = 
 +                  lock output (fun () -> 
 +#if SILVERLIGHT
 +                  output.Add (isOut, None ,c)) 
 +#else
 +                  output.Add (isOut, (try Some System.Console.ForegroundColor with _ -> None) ,c)) 
 +#endif
 +              member x.Encoding = Encoding.UTF8 }
 +#if FX_ATLEAST_SILVERLIGHT_50
 +#else
 +    do ignore outWriter
 +    do System.Console.SetOut (outWriter true)
 +    do System.Console.SetError (outWriter false)
 +#endif
 +    member x.GetTextAndClear() = lock output (fun () -> let res = output.ToArray() in output.Clear(); res)
 +
 +#if SILVERLIGHT
 +#else
 +/// Implement the optional resident compilation service
 +module FSharpResidentCompiler = 
 +
 +    open System
 +    open System.Diagnostics
 +    open System.Runtime.Remoting.Channels
 +    open System.Runtime.Remoting
 +    open System.Runtime.Remoting.Lifetime
 +
 +    /// The compilation server, which runs in the server process. Accessed by clients using .NET remoting.
 +    type FSharpCompilationServer(exiter:Exiter)  =
 +        inherit MarshalByRefObject()  
 +
 +        static let onWindows = 
 +            match System.Environment.OSVersion.Platform with 
 +            | PlatformID.Win32NT | PlatformID.Win32S | PlatformID.Win32Windows | PlatformID.WinCE -> true
 +            | _  -> false
 +
 +        // The channel/socket name is qualified by the user name (and domain on windows)
 +        static let domainName = if onWindows then Environment.GetEnvironmentVariable "USERDOMAIN" else ""
 +        static let userName = Environment.GetEnvironmentVariable (if onWindows then "USERNAME" else "USER") 
 +        // Use different base channel names on mono and CLR as a CLR remoting process can't talk
 +        // to a mono server
 +        static let baseChannelName = if runningOnMono then "FSCChannelMono" else "FSCChannel"
 +        static let channelName = baseChannelName + "_" +  domainName + "_" + userName
 +        static let serverName = if runningOnMono then "FSCServerMono" else "FSCSever"
 +        static let mutable serverExists = true
 +        
 +        let outputCollector = new OutputCollector()
 +
 +        // This background agent ensures all compilation requests sent to the server are serialized
 +        let agent = MailboxProcessor<_>.Start(fun inbox -> 
 +                       async { 
 +                          while true do 
 +                              let! (pwd,argv, reply: AsyncReplyChannel<_>) = inbox.Receive()
 +                              if !progress then printfn "server agent: got compilation request, argv = %A" argv
 +                              let exitCode = 
 +                                  try 
 +                                      Environment.CurrentDirectory <- pwd
 +                                      mainCompile (argv, true, exiter); 
 +                                      if !progress then printfn "server: finished compilation request, argv = %A" argv
 +                                      0
 +                                  with e -> 
-                                       if !progress then printfn "server: finished compilation request with errors, argv = %A" argv
-                                       errorRecoveryNoRange e
++                                      if !progress then printfn "server: finished compilation request with errors, argv = %A, e = %s" argv (e.ToString())
++                                      stopProcessingRecovery e range0
 +                                      1
 +                              let output = outputCollector.GetTextAndClear()
++                              if !progress then printfn "ouput: %A" output
++                              if !progress then printfn "sending reply..." 
 +                              reply.Reply(output, exitCode)
++                              if !progress then printfn "collecting..." 
 +                              GC.Collect(3)
++                              if !progress then printfn "considering exit..." 
 +                              // Exit the server if there are no outstanding requests and the 
 +                              // current memory usage after collection is over 200MB
 +                              if inbox.CurrentQueueLength = 0 && GC.GetTotalMemory(true) > 200L * 1024L * 1024L then 
 +                                  Environment.Exit 0
 +                       })
 +
 +        member x.Run() = 
 +            while serverExists do 
 +               if !progress then printfn "server: startup thread sleeping..." 
 +               System.Threading.Thread.Sleep 1000
 +
 +        abstract Ping : unit -> string
 +        abstract Compile : string * string[] -> (bool * System.ConsoleColor option * char) [] * int
 +        default x.Ping() = "ping"
 +        default x.Compile (pwd,argv) = 
 +            if !progress then printfn "server: got compilation request, (pwd, argv) = %A" (pwd, argv)
-             agent.PostAndReply(fun reply -> (pwd,argv,reply))
- 
++            let res = agent.PostAndReply(fun reply -> (pwd,argv,reply))
++            if !progress then printfn "server: got response, response = %A" res
++            res 
++            
 +        override x.Finalize() =
 +            serverExists <- false
 +
 +        // This is called on the server object by .NET remoting to initialize the lifetime characteristics
 +        // of the server object.
 +        override x.InitializeLifetimeService() =
 +            let lease = (base.InitializeLifetimeService() :?> ILease)
 +            if (lease.CurrentState = LeaseState.Initial)  then
 +                lease.InitialLeaseTime <- TimeSpan.FromDays(1.0);
 +                lease.SponsorshipTimeout <- TimeSpan.FromMinutes(2.0);
 +                lease.RenewOnCallTime <- TimeSpan.FromDays(1.0);
 +            box lease
 +            
 +        static member RunServer(exiter:Exiter) =
-             progress := condition "FSHARP_SERVER_PROGRESS"
++            progress := !progress ||  condition "FSHARP_SERVER_PROGRESS"
 +            if !progress then printfn "server: initializing server object" 
 +            let server = new FSharpCompilationServer(exiter)
 +            let chan = new Ipc.IpcChannel(channelName) 
 +            ChannelServices.RegisterChannel(chan,false);
 +            RemotingServices.Marshal(server,serverName)  |> ignore
 +
 +            // On Unix, the file permissions of the implicit socket need to be set correctly to make this
 +            // private to the user.
 +            if runningOnMono then 
 +              try 
 +                  let monoPosix = System.Reflection.Assembly.Load("Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756")
 +                  let monoUnixFileInfo = monoPosix.GetType("Mono.Unix.UnixFileSystemInfo") 
 +                  let socketName = Path.Combine(FileSystem.GetTempPathShim(), channelName)
 +                  let fileEntry = monoUnixFileInfo.InvokeMember("GetFileSystemEntry", (BindingFlags.InvokeMethod ||| BindingFlags.Static ||| BindingFlags.Public), null, null, [| box socketName |],System.Globalization.CultureInfo.InvariantCulture)
 +                  // Add 0x00000180 (UserReadWriteExecute) to the access permissions on Unix
 +                  monoUnixFileInfo.InvokeMember("set_FileAccessPermissions", (BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public), null, fileEntry, [| box 0x00000180 |],System.Globalization.CultureInfo.InvariantCulture) |> ignore
 +#if DEBUG
-                   printfn "server: good, set permissions on socket name '%s'"  socketName
++                  if !progress then printfn "server: good, set permissions on socket name '%s'"  socketName
 +                  let fileEntry = monoUnixFileInfo.InvokeMember("GetFileSystemEntry", (BindingFlags.InvokeMethod ||| BindingFlags.Static ||| BindingFlags.Public), null, null, [| box socketName |],System.Globalization.CultureInfo.InvariantCulture)
 +                  let currPermissions = monoUnixFileInfo.InvokeMember("get_FileAccessPermissions", (BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public), null, fileEntry, [| |],System.Globalization.CultureInfo.InvariantCulture) |> unbox<int>
 +                  if !progress then printfn "server: currPermissions = '%o' (octal)"  currPermissions
 +#endif
 +              with e -> 
 +#if DEBUG
 +                  printfn "server: failed to set permissions on socket, perhaps on windows? Is is not needed there."  
 +#endif
 +                  ()
 +                  // Fail silently
 +            server.Run()
 +            
 +        static member private ConnectToServer() =
 +            Activator.GetObject(typeof<FSharpCompilationServer>,"ipc://" + channelName + "/" + serverName) 
 +            :?> FSharpCompilationServer 
 +
 +        static member TryCompileUsingServer(fscServerExe,argv) =
++            // Enable these lines to write a log file, e.g. when running under xbuild
++            //let os = System.IO.File.CreateText "/tmp/fsc-client-log"
++            //let printfn fmt = Printf.kfprintf (fun () -> fprintfn os ""; os.Flush()) os fmt
++            progress := !progress ||  condition "FSHARP_SERVER_PROGRESS"
 +            let pwd = System.Environment.CurrentDirectory
 +            let clientOpt = 
++                if !progress then printfn "client: creating client"
 +                // Detect the absence of the channel via the exception. Probably not the best way.
 +                // Different exceptions get thrown here on Mono and Windows.
 +                let client = FSharpCompilationServer.ConnectToServer()
 +                try 
 +                    if !progress then printfn "client: attempting to connect to existing service (1)"
 +                    client.Ping() |> ignore
 +                    if !progress then printfn "client: connected to existing service"
 +                    Some client
 +                with _ ->
++                    if !progress then printfn "client: error while creating client, starting client instead"
 +                    let procInfo = 
 +                        if runningOnMono then
 +                            let shellName, useShellExecute = 
 +                                match System.Environment.GetEnvironmentVariable("FSC_MONO") with 
 +                                | null -> 
 +                                    if onWindows then 
++                                        // e.g. "C:\Program Files\Mono-2.6.1\lib\mono\2.0\mscorlib.dll" --> "C:\Program Files\Mono-2.6.1\bin\mono.exe"
 +                                        Path.Combine(Path.GetDirectoryName (typeof<Object>.Assembly.Location), @"..\..\..\bin\mono.exe"), false
 +                                    else
-                                         "mono", true
-                                 | path -> path, false
++                                        "mono-sgen", true
++                                | path -> path, true
 +                                     
-                             // e.g. "C:\Program Files\Mono-2.6.1\lib\mono20\mscorlib.dll" --> "C:\Program Files\Mono-2.6.1\bin\mono.exe"
 +                            ProcessStartInfo(FileName = shellName,
 +                                             Arguments = fscServerExe + " /server",
 +                                             CreateNoWindow = true,
 +                                             UseShellExecute = useShellExecute)
 +                         else
 +                            ProcessStartInfo(FileName=fscServerExe,
 +                                             Arguments = "/server",
 +                                             CreateNoWindow = true,
 +                                             UseShellExecute = false)
 +
 +                    let cmdProcess = new Process(StartInfo=procInfo)
 +
 +                    //let exitE = cmdProcess.Exited |> Observable.map (fun x -> x)
 +
 +                    cmdProcess.Start() |> ignore
 +                    //exitE.Add(fun _ -> if !progress then eprintfn "client: the server has exited")
 +                    cmdProcess.EnableRaisingEvents <- true;
 +                     
 +                    // Create the client proxy and attempt to connect to the server
 +                    let rec tryAcccesServer nRemaining =
++                        if !progress then printfn "client: trying to access server, nRemaining = '%d'" nRemaining
 +                        if nRemaining = 0 then 
 +                            // Failed to connect to server, give up 
 +                            None
 +                        else
 +                            try 
 +                                if !progress then printfn "client: attempting to connect to existing service (2)"
 +                                client.Ping() |> ignore
 +                                if !progress then printfn "client: connected to existing service"
 +                                Some client
 +                            // Detect the absence of the channel via the exception. Probably not the best way.
 +                            // Different exceptions get thrown here on Mono and Windows.
 +                            with _ (* System.Runtime.Remoting.RemotingException *) ->
 +                                // Sleep a bit
 +                                System.Threading.Thread.Sleep 50
 +                                tryAcccesServer (nRemaining - 1)
 +
 +                    tryAcccesServer 20
 +
 +            match clientOpt with
 +            | Some client -> 
 +                if !progress then printfn "client: calling client.Compile(%A)" argv
 +                // Install the global error logger and never remove it. This logger does have all command-line flags considered.
 +                try 
 +                    let (output, exitCode) = 
 +                        try client.Compile (pwd, argv) 
 +                        with e -> 
 +                           printfn "server error: %s" (e.ToString())
 +                           raise (Error (FSComp.SR.fscRemotingError(), rangeStartup))
 +                        
 +                    if !progress then printfn "client: returned from client.Compile(%A), res = %d" argv exitCode
 +                    use holder = 
 +                        try let originalConsoleColor = Console.ForegroundColor 
 +                            { new System.IDisposable with member x.Dispose() = Console.ForegroundColor <- originalConsoleColor }
 +                        with _ -> null
 +                    let mutable prevConsoleColor = try Console.ForegroundColor with _ -> ConsoleColor.Black
 +                    for (isOut, consoleColorOpt, c:char) in output do 
 +                        try match consoleColorOpt with 
 +                             | Some consoleColor -> 
 +                                 if prevConsoleColor <> consoleColor then 
 +                                     Console.ForegroundColor <- consoleColor; 
 +                             | None -> ()
 +                        with _ -> ()
 +                        c |> (if isOut then System.Console.Out.Write else System.Console.Error.Write)
 +                    Some exitCode
 +                with err -> 
 +                   let sb = System.Text.StringBuilder()
 +                   OutputErrorOrWarning (pwd,true,false,ErrorStyle.DefaultErrors,true) sb (PhasedError.Create(err,BuildPhase.Compile))
 +                   eprintfn "%s" (sb.ToString())
 +                   // We continue on and compile in-process - the server appears to have died half way through.
 +                   None
 +            | None -> 
 +                None
 +
++
 +let main (fscServerExe, argv) = 
 +    let inline hasArgument name args = 
 +        args |> Array.exists (fun x -> x = ("--" + name) || x = ("/" + name))
 +    let inline stripArgument name args = 
 +        args |> Array.filter (fun x -> x <> ("--" + name) && x <> ("/" + name))
 +
 +    // Check for --pause as the very first step so that a compiler can be attached here.
 +    if hasArgument "pause" argv then 
 +        System.Console.WriteLine("Press any key to continue...")
 +        System.Console.ReadKey() |> ignore
 +      
 +    if runningOnMono && hasArgument "resident" argv then 
 +        let argv = stripArgument "resident" argv
 +
 +        if not (hasArgument "nologo" argv) then 
 +            printfn "%s" (FSComp.SR.buildProductName(FSharpEnvironment.FSharpTeamVersionNumber))
 +            printfn "%s" (FSComp.SR.optsCopyright())
 +
 +        let exitCodeOpt = FSharpResidentCompiler.FSharpCompilationServer.TryCompileUsingServer (fscServerExe, argv)
 +        match exitCodeOpt with 
 +        | Some exitCode -> exitCode
 +        | None -> 
 +            mainCompile (argv, true, QuitProcessExiter)
 +            0
 +
 +    elif runningOnMono && hasArgument "server" argv then 
 +        // Install the right exiter so we can catch "StopProcessing" without exiting the server
 +        let exiter = { new Exiter with member x.Exit n = raise StopProcessing }
 +        FSharpResidentCompiler.FSharpCompilationServer.RunServer(exiter)        
 +        0
 +        
 +    else
 +        mainCompile (argv, false, QuitProcessExiter)
 +        0
 +
 +#endif // SILVERLIGHT
 +#endif // NO_COMPILER_BACKEND
diff --cc src/fsharp/fscmain.fs
index 9744a51,bd472e8..8753b61
--- a/src/fsharp/fscmain.fs
+++ b/src/fsharp/fscmain.fs
@@@ -13,8 -13,12 +13,12 @@@
  
  module internal Microsoft.FSharp.Compiler.CommandLineMain
  
+ open System.IO
+ open System.Text
+ open System.Reflection
  open Microsoft.FSharp.Compiler
 -open Microsoft.FSharp.Compiler.AbstractIL.IL
 +open Microsoft.FSharp.Compiler.AbstractIL.IL // runningOnMono 
+ open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library 
  open Microsoft.FSharp.Compiler.ErrorLogger
  open Microsoft.FSharp.Compiler.Driver
  open Internal.Utilities
@@@ -25,7 -29,284 +29,6 @@@ open System.Runtime.CompilerService
  
  type TypeInThisAssembly() = member x.Dummy = 1
  
 -/// Collect the output from the stdout and stderr streams, character by character,
 -/// recording the console color used along the way.
 -type OutputCollector() = 
 -    let output = ResizeArray()
 -    let outWriter isOut = 
 -        { new TextWriter() with 
 -              member x.Write(c:char) = 
 -                  lock output (fun () -> 
 -                  output.Add (isOut, (try Some System.Console.ForegroundColor with _ -> None) ,c)) 
 -              member x.Encoding = Encoding.UTF8 }
 -    do ignore outWriter
 -    do System.Console.SetOut (outWriter true)
 -    do System.Console.SetError (outWriter false)
 -    member x.GetTextAndClear() = lock output (fun () -> let res = output.ToArray() in output.Clear(); res)
 -
 -/// Implement the optional resident compilation service
 -module FSharpResidentCompiler = 
 -
 -    open System
 -    open System.Diagnostics
 -    open System.Runtime.Remoting.Channels
 -    open System.Runtime.Remoting
 -    open System.Runtime.Remoting.Lifetime
 -
 -    /// The compilation server, which runs in the server process. Accessed by clients using .NET remoting.
 -    type FSharpCompilationServer()  =
 -        inherit MarshalByRefObject()  
 -
 -        static let onWindows = 
 -            match System.Environment.OSVersion.Platform with 
 -            | PlatformID.Win32NT | PlatformID.Win32S | PlatformID.Win32Windows | PlatformID.WinCE -> true
 -            | _  -> false
 -
 -        // The channel/socket name is qualified by the user name (and domain on windows)
 -        static let domainName = if onWindows then Environment.GetEnvironmentVariable "USERDOMAIN" else ""
 -        static let userName = Environment.GetEnvironmentVariable (if onWindows then "USERNAME" else "USER") 
 -        // Use different base channel names on mono and CLR as a CLR remoting process can't talk
 -        // to a mono server
 -        static let baseChannelName = if runningOnMono then "FSCChannelMono" else "FSCChannel"
 -        static let channelName = baseChannelName + "_" +  domainName + "_" + userName
 -        static let serverName = if runningOnMono then "FSCServerMono" else "FSCSever"
 -        static let mutable serverExists = true
 -        
 -        let outputCollector = new OutputCollector()
 -
 -        // This background agent ensures all compilation requests sent to the server are serialized
 -        let agent = MailboxProcessor<_>.Start(fun inbox -> 
 -                       async { 
 -                          while true do 
 -                              let! (pwd,argv, reply: AsyncReplyChannel<_>) = inbox.Receive()
 -                              if !progress then printfn "server agent: got compilation request, argv = %A" argv
 -                              let exitCode = 
 -                                  try 
 -                                      Environment.CurrentDirectory <- pwd
 -                                      // Install the right exiter so we can catch "StopProcessing" without exiting the server
 -                                      let exiter = { new Exiter with member x.Exit n = raise StopProcessing }
 -                                      let createErrorLogger = (fun tcConfigB -> ErrorLoggerThatQuitsAfterMaxErrors(tcConfigB, exiter))
 -                                      mainCompile (argv, true, exiter,createErrorLogger); 
 -                                      if !progress then printfn "server: finished compilation request, argv = %A" argv
 -                                      0
 -                                  with e -> 
 -                                      if !progress then printfn "server: finished compilation request with errors, argv = %A, e = %s" argv (e.ToString())
 -                                      stopProcessingRecovery e range0
 -                                      1
 -                              let output = outputCollector.GetTextAndClear()
 -                              if !progress then printfn "ouput: %A" output
 -                              if !progress then printfn "sending reply..." 
 -                              reply.Reply(output, exitCode)
 -                              if !progress then printfn "collecting..." 
 -                              GC.Collect(3)
 -                              if !progress then printfn "considering exit..." 
 -                              // Exit the server if there are no outstanding requests and the 
 -                              // current memory usage after collection is over 200MB
 -                              if inbox.CurrentQueueLength = 0 && GC.GetTotalMemory(true) > 200L * 1024L * 1024L then 
 -                                  Environment.Exit 0
 -                       })
 -
 -        member x.Run() = 
 -            while serverExists do 
 -               if !progress then printfn "server: startup thread sleeping..." 
 -               System.Threading.Thread.Sleep 1000
 -
 -        abstract Ping : unit -> string
 -        abstract Compile : string * string[] -> (bool * System.ConsoleColor option * char) [] * int
 -        default x.Ping() = "ping"
 -        default x.Compile (pwd,argv) = 
 -            if !progress then printfn "server: got compilation request, (pwd, argv) = %A" (pwd, argv)
 -            let res = agent.PostAndReply(fun reply -> (pwd,argv,reply))
 -            if !progress then printfn "server: got response, response = %A" res
 -            res 
 -            
 -        override x.Finalize() =
 -            serverExists <- false
 -
 -        // This is called on the server object by .NET remoting to initialize the lifetime characteristics
 -        // of the server object.
 -        override x.InitializeLifetimeService() =
 -            let lease = (base.InitializeLifetimeService() :?> ILease)
 -            if (lease.CurrentState = LeaseState.Initial)  then
 -                lease.InitialLeaseTime <- TimeSpan.FromDays(1.0);
 -                lease.SponsorshipTimeout <- TimeSpan.FromMinutes(2.0);
 -                lease.RenewOnCallTime <- TimeSpan.FromDays(1.0);
 -            box lease
 -            
 -        static member RunServer() =
 -            progress := !progress ||  condition "FSHARP_SERVER_PROGRESS"
 -            if !progress then printfn "server: initializing server object" 
 -            let server = new FSharpCompilationServer()
 -            let chan = new Ipc.IpcChannel(channelName) 
 -            ChannelServices.RegisterChannel(chan,false);
 -            RemotingServices.Marshal(server,serverName)  |> ignore
 -
 -            // On Unix, the file permissions of the implicit socket need to be set correctly to make this
 -            // private to the user.
 -            if runningOnMono then 
 -              try 
 -                  let monoPosix = System.Reflection.Assembly.Load("Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756")
 -                  let monoUnixFileInfo = monoPosix.GetType("Mono.Unix.UnixFileSystemInfo") 
 -                  let socketName = Path.Combine(FileSystem.GetTempPathShim(), channelName)
 -                  let fileEntry = monoUnixFileInfo.InvokeMember("GetFileSystemEntry", (BindingFlags.InvokeMethod ||| BindingFlags.Static ||| BindingFlags.Public), null, null, [| box socketName |],System.Globalization.CultureInfo.InvariantCulture)
 -                  // Add 0x00000180 (UserReadWriteExecute) to the access permissions on Unix
 -                  monoUnixFileInfo.InvokeMember("set_FileAccessPermissions", (BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public), null, fileEntry, [| box 0x00000180 |],System.Globalization.CultureInfo.InvariantCulture) |> ignore
 -#if DEBUG
 -                  if !progress then printfn "server: good, set permissions on socket name '%s'"  socketName
 -                  let fileEntry = monoUnixFileInfo.InvokeMember("GetFileSystemEntry", (BindingFlags.InvokeMethod ||| BindingFlags.Static ||| BindingFlags.Public), null, null, [| box socketName |],System.Globalization.CultureInfo.InvariantCulture)
 -                  let currPermissions = monoUnixFileInfo.InvokeMember("get_FileAccessPermissions", (BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public), null, fileEntry, [| |],System.Globalization.CultureInfo.InvariantCulture) |> unbox<int>
 -                  if !progress then printfn "server: currPermissions = '%o' (octal)"  currPermissions
 -#endif
 -              with e -> 
 -#if DEBUG
 -                  printfn "server: failed to set permissions on socket, perhaps on windows? Is is not needed there."  
 -#endif
 -                  ()
 -                  // Fail silently
 -            server.Run()
 -            
 -        static member private ConnectToServer() =
 -            Activator.GetObject(typeof<FSharpCompilationServer>,"ipc://" + channelName + "/" + serverName) 
 -            :?> FSharpCompilationServer 
 -
 -        static member TryCompileUsingServer(fscServerExe,argv) =
 -            // Enable these lines to write a log file, e.g. when running under xbuild
 -            //let os = System.IO.File.CreateText "/tmp/fsc-client-log"
 -            //let printfn fmt = Printf.kfprintf (fun () -> fprintfn os ""; os.Flush()) os fmt
 -            progress := !progress ||  condition "FSHARP_SERVER_PROGRESS"
 -            let pwd = System.Environment.CurrentDirectory
 -            let clientOpt = 
 -                if !progress then printfn "client: creating client"
 -                // Detect the absence of the channel via the exception. Probably not the best way.
 -                // Different exceptions get thrown here on Mono and Windows.
 -                let client = FSharpCompilationServer.ConnectToServer()
 -                try 
 -                    if !progress then printfn "client: attempting to connect to existing service (1)"
 -                    client.Ping() |> ignore
 -                    if !progress then printfn "client: connected to existing service"
 -                    Some client
 -                with _ ->
 -                    if !progress then printfn "client: error while creating client, starting client instead"
 -                    let procInfo = 
 -                        if runningOnMono then
 -                            let shellName, useShellExecute = 
 -                                match System.Environment.GetEnvironmentVariable("FSC_MONO") with 
 -                                | null -> 
 -                                    if onWindows then 
 -                                        // e.g. "C:\Program Files\Mono-2.6.1\lib\mono\2.0\mscorlib.dll" --> "C:\Program Files\Mono-2.6.1\bin\mono.exe"
 -                                        Path.Combine(Path.GetDirectoryName (typeof<Object>.Assembly.Location), @"..\..\..\bin\mono.exe"), false
 -                                    else
 -                                        "mono-sgen", true
 -                                | path -> path, true
 -                                     
 -                            ProcessStartInfo(FileName = shellName,
 -                                             Arguments = fscServerExe + " /server",
 -                                             CreateNoWindow = true,
 -                                             UseShellExecute = useShellExecute)
 -                         else
 -                            ProcessStartInfo(FileName=fscServerExe,
 -                                             Arguments = "/server",
 -                                             CreateNoWindow = true,
 -                                             UseShellExecute = false)
 -
 -                    let cmdProcess = new Process(StartInfo=procInfo)
 -
 -                    //let exitE = cmdProcess.Exited |> Observable.map (fun x -> x)
 -
 -                    cmdProcess.Start() |> ignore
 -                    //exitE.Add(fun _ -> if !progress then eprintfn "client: the server has exited")
 -                    cmdProcess.EnableRaisingEvents <- true;
 -                     
 -                    // Create the client proxy and attempt to connect to the server
 -                    let rec tryAcccesServer nRemaining =
 -                        if !progress then printfn "client: trying to access server, nRemaining = '%d'" nRemaining
 -                        if nRemaining = 0 then 
 -                            // Failed to connect to server, give up 
 -                            None
 -                        else
 -                            try 
 -                                if !progress then printfn "client: attempting to connect to existing service (2)"
 -                                client.Ping() |> ignore
 -                                if !progress then printfn "client: connected to existing service"
 -                                Some client
 -                            // Detect the absence of the channel via the exception. Probably not the best way.
 -                            // Different exceptions get thrown here on Mono and Windows.
 -                            with _ (* System.Runtime.Remoting.RemotingException *) ->
 -                                // Sleep a bit
 -                                System.Threading.Thread.Sleep 50
 -                                tryAcccesServer (nRemaining - 1)
 -
 -                    tryAcccesServer 20
 -
 -            match clientOpt with
 -            | Some client -> 
 -                if !progress then printfn "client: calling client.Compile(%A)" argv
 -                // Install the global error logger and never remove it. This logger does have all command-line flags considered.
 -                try 
 -                    let (output, exitCode) = 
 -                        try client.Compile (pwd, argv) 
 -                        with e -> 
 -                           printfn "server error: %s" (e.ToString())
 -                           raise (Error (FSComp.SR.fscRemotingError(), rangeStartup))
 -                        
 -                    if !progress then printfn "client: returned from client.Compile(%A), res = %d" argv exitCode
 -                    use holder = 
 -                        try let originalConsoleColor = Console.ForegroundColor 
 -                            { new System.IDisposable with member x.Dispose() = Console.ForegroundColor <- originalConsoleColor }
 -                        with _ -> null
 -                    let mutable prevConsoleColor = try Console.ForegroundColor with _ -> ConsoleColor.Black
 -                    for (isOut, consoleColorOpt, c:char) in output do 
 -                        try match consoleColorOpt with 
 -                             | Some consoleColor -> 
 -                                 if prevConsoleColor <> consoleColor then 
 -                                     Console.ForegroundColor <- consoleColor; 
 -                             | None -> ()
 -                        with _ -> ()
 -                        c |> (if isOut then System.Console.Out.Write else System.Console.Error.Write)
 -                    Some exitCode
 -                with err -> 
 -                   let sb = System.Text.StringBuilder()
 -                   OutputErrorOrWarning (pwd,true,false,ErrorStyle.DefaultErrors,true) sb (PhasedError.Create(err,BuildPhase.Compile))
 -                   eprintfn "%s" (sb.ToString())
 -                   // We continue on and compile in-process - the server appears to have died half way through.
 -                   None
 -            | None -> 
 -                None
 -
 -module Driver = 
 -    let main argv = 
 -        // Check for --pause as the very first step so that a compiler can be attached here.
 -        if argv |> Array.exists  (fun x -> x = "/pause" || x = "--pause") then 
 -            System.Console.WriteLine("Press any key to continue...")
 -            System.Console.ReadKey() |> ignore
 -        if argv |> Array.exists  (fun x -> x = "/resident" || x = "--resident") then 
 -            let argv = argv |> Array.filter (fun x -> x <> "/resident" && x <> "--resident")
 -
 -            if not (argv |> Array.exists (fun x -> x = "/nologo" || x = "--nologo")) then 
 -                printfn "%s" (FSComp.SR.buildProductName(FSharpEnvironment.DotNetBuildString))
 -                printfn "%s" (FSComp.SR.optsCopyright())
 -
 -            let fscServerExe = typeof<TypeInThisAssembly>.Assembly.Location
 -            let exitCodeOpt = FSharpResidentCompiler.FSharpCompilationServer.TryCompileUsingServer(fscServerExe,argv)
 -            match exitCodeOpt with 
 -            | Some exitCode -> exitCode
 -            | None -> 
 -                let exiter = QuitProcessExiter
 -                let createErrorLogger = (fun tcConfigB -> ErrorLoggerThatQuitsAfterMaxErrors(tcConfigB, exiter))
 -                mainCompile (argv, true, exiter, createErrorLogger)
 -                0
 -
 -        elif argv |> Array.exists  (fun x -> x = "/server" || x = "--server") then 
 -            FSharpResidentCompiler.FSharpCompilationServer.RunServer()        
 -            0
 -        
 -        else
 -            let exiter = QuitProcessExiter
 -            let createErrorLogger = (fun tcConfigB -> ErrorLoggerThatQuitsAfterMaxErrors(tcConfigB, exiter))
 -            mainCompile (argv, false, QuitProcessExiter, createErrorLogger)
 -            0 
 -
--
  [<Dependency("FSharp.Compiler",LoadHint.Always)>] 
  do ()
  
diff --cc src/fsharp/fscopts.fs
index 96cfb14,74852b0..af2cd79
--- a/src/fsharp/fscopts.fs
+++ b/src/fsharp/fscopts.fs
@@@ -459,10 -451,10 +459,11 @@@ let vsSpecificFlags (tcConfigB: TcConfi
      CompilerOption("validate-type-providers", tagNone, OptionUnit (fun () -> tcConfigB.validateTypeProviders <- true), None, None);
      CompilerOption("LCID", tagInt, OptionInt (fun n -> tcConfigB.lcid <- Some(n)), None, None);
      CompilerOption("flaterrors", tagNone, OptionUnit (fun () -> tcConfigB.flatErrors <- true), None, None); 
 +    CompilerOption("sqmsessionguid", tagNone, OptionString (fun s -> tcConfigB.sqmSessionGuid <- try System.Guid(s) |> Some  with e -> None), None, None);
+     CompilerOption("gccerrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.GccErrors), None, None); 
      CompilerOption("maxerrors", tagInt, OptionInt (fun n -> tcConfigB.maxErrors <- n), None, None); ]
 -      
 -          
 +
 +
  let internalFlags (tcConfigB:TcConfigBuilder) =
    [
      CompilerOption("use-incremental-build", tagNone, OptionUnit (fun () -> tcConfigB.useIncrementalBuilder <- true), None, None)
@@@ -1018,7 -1010,6 +1019,7 @@@ let DoWithErrorColor isWarn f 
                  ignoreFailureOnMono1_1_16 (fun () -> Console.ForegroundColor <- c)
  #endif
  
 +
            
  
-         
+         
diff --cc src/fsharp/fsi/Fsi.fsproj
index c907b74,563e4c9..b991e6d
mode 100755,100644..100644
--- a/src/fsharp/fsi/Fsi.fsproj
+++ b/src/fsharp/fsi/Fsi.fsproj
@@@ -1,7 -1,20 +1,10 @@@
  <?xml version="1.0" encoding="utf-8"?>
 -<!--
 -# Copyright (c) 2002-2011 Microsoft Corporation. 
 -#
 -# 
 -# 
 -# 
 -#
 -#
 -# You must not remove this notice, or any other, from this software.
 --->
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
-     <FSharpSourcesRoot>..\..</FSharpSourcesRoot>
+     <FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..</FSharpSourcesRoot>
+     <ProductVersion>10.0.0</ProductVersion>
+     <SchemaVersion>2.0</SchemaVersion>
+     <UsePartialTypes>False</UsePartialTypes>
    </PropertyGroup>
    <Import Project="$(FSharpSourcesRoot)\FSharpSource.Settings.targets" />
    <PropertyGroup>
diff --cc src/fsharp/fsi/fsi.exe.config
index 10ef015,694b0ff..e48f68f
--- a/src/fsharp/fsi/fsi.exe.config
+++ b/src/fsharp/fsi/fsi.exe.config
@@@ -10,24 -10,16 +10,30 @@@
            culture="neutral"/>
          <bindingRedirect
            oldVersion="2.0.0.0"
 -          newVersion="4.3.0.0"/>
 +          newVersion="4.3.1.0"/>
          <bindingRedirect
+           oldVersion="2.3.0.0"
+           newVersion="4.3.0.0"/>
+         <bindingRedirect
+           oldVersion="2.3.5.0"
+           newVersion="4.3.0.0"/>
+         <bindingRedirect
            oldVersion="4.0.0.0"
 -          newVersion="4.3.0.0"/>
 +          newVersion="4.3.1.0"/>
 +        <bindingRedirect
 +          oldVersion="4.3.0.0"
 +          newVersion="4.3.1.0"/>
 +        <!-- Old style portable -->
 +        <bindingRedirect
 +          oldVersion="2.3.5.0"
 +          newVersion="4.3.1.0"/>
 +        <bindingRedirect
 +          oldVersion="2.3.5.1"
 +          newVersion="4.3.1.0"/>
 +        <!-- .NETCore portable -->
 +        <bindingRedirect
 +          oldVersion="3.3.1.0"
 +          newVersion="4.3.1.0"/>
        </dependentAssembly>
      </assemblyBinding>
    </runtime>
diff --cc src/fsharp/fsi/fsi.fs
index 4533578,82fee53..dea1f6a
mode 100755,100644..100755
--- a/src/fsharp/fsi/fsi.fs
+++ b/src/fsharp/fsi/fsi.fs
@@@ -83,21 -84,7 +84,21 @@@ open System.Runtime.CompilerService
  [<Dependency("FSharp.Core",LoadHint.Always)>] do ()
  #endif
  
 +
- module Utilities = 
+ module internal Utilities = 
 +    type IAnyToLayoutCall = 
 +        abstract AnyToLayout : FormatOptions * obj -> Internal.Utilities.StructuredFormat.Layout
 +        abstract FsiAnyToLayout : FormatOptions * obj -> Internal.Utilities.StructuredFormat.Layout
 +
 +    type private AnyToLayoutSpecialization<'T>() = 
 +        interface IAnyToLayoutCall with
 +            member this.AnyToLayout(options, o : obj) = Internal.Utilities.StructuredFormat.Display.any_to_layout options (Unchecked.unbox o : 'T)
 +            member this.FsiAnyToLayout(options, o : obj) = Internal.Utilities.StructuredFormat.Display.fsi_any_to_layout options (Unchecked.unbox o : 'T)
 +    
 +    let getAnyToLayoutCall ty = 
 +        let specialized = typedefof<AnyToLayoutSpecialization<_>>.MakeGenericType [| ty |]
 +        Activator.CreateInstance(specialized) :?> IAnyToLayoutCall
 +
      let callStaticMethod (ty:Type) name args =
  #if SILVERLIGHT
          ty.InvokeMember(name, (BindingFlags.InvokeMethod ||| BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic), null, null, Array.ofList args)
@@@ -149,8 -136,11 +150,8 @@@ type internal FsiTimeReporter(outWriter
      member tr.TimeOpIf flag f = if flag then tr.TimeOp f else f ()
  #endif
  
 -//----------------------------------------------------------------------------
 -// value printing
 -//----------------------------------------------------------------------------
  
- type FsiValuePrinterMode = 
+ type internal FsiValuePrinterMode = 
      | PrintExpr 
      | PrintDecl
  
@@@ -1480,8 -1493,9 +1502,9 @@@ module internal MagicAssemblyResolutio
                     match tcImports.TryFindProviderGeneratedAssemblyByName(simpleAssemName) with
                     | Some(assembly) -> OkResult([],Choice2Of2 assembly)
                     | None -> 
+ #endif
                     
 -                   // Try to find the reference without an extension
 +                   // As a last resort, try to find the reference without an extension
                     match tcImports.TryFindExistingFullyQualifiedPathFromAssemblyRef(ILAssemblyRef.Create(simpleAssemName,None,None,false,None,None)) with
                     | Some(resolvedPath) -> 
                         OkResult([],Choice1Of2 resolvedPath)
@@@ -2417,64 -2453,13 +2465,67 @@@ type FsiEvaluationSession (argv:string[
                  fun () ->          
                      fprintfn fsiConsoleOutput.Error "%s" (exn.ToString())
                      errorLogger.SetError()
 -                    errorLogger.AbortOnError()
 +                    try 
 +                        errorLogger.AbortOnError() 
 +                    with StopProcessing -> 
 +                        // BUG 664864: Watson Clr20r3 across buckets with: Application FSIAnyCPU.exe from Dev11 RTM; Exception AE251Y0L0P2WC0QSWDZ0E2IDRYQTDSVB; FSIANYCPU.NI.EXE!Microsoft.FSharp.Compiler.Interactive.Shell+threadException
 +                        // reason: some window that use System.Windows.Forms.DataVisualization types (possible FSCharts) was created in FSI.
 +                        // at some moment one chart has raised InvalidArgumentException from OnPaint, this exception was intercepted by the code in higher layer and 
 +                        // passed to Application.OnThreadException. FSI has already attached its own ThreadException handler, inside it will log the original error
 +                        // and then raise StopProcessing exception to unwind the stack (and possibly shut down current Application) and get to DriveFsiEventLoop.
 +                        // DriveFsiEventLoop handles StopProcessing by suppressing it and restarting event loop from the beginning.
 +                        // This schema works almost always except when FSI is started as 64 bit process (FsiAnyCpu) on Windows 7.
 +
 +                        // http://msdn.microsoft.com/en-us/library/windows/desktop/ms633573(v=vs.85).aspx
 +                        // Remarks:
 +                        // If your application runs on a 32-bit version of Windows operating system, uncaught exceptions from the callback 
 +                        // will be passed onto higher-level exception handlers of your application when available. 
 +                        // The system then calls the unhandled exception filter to handle the exception prior to terminating the process. 
 +                        // If the PCA is enabled, it will offer to fix the problem the next time you run the application.
 +                        // However, if your application runs on a 64-bit version of Windows operating system or WOW64, 
 +                        // you should be aware that a 64-bit operating system handles uncaught exceptions differently based on its 64-bit processor architecture, 
 +                        // exception architecture, and calling convention. 
 +                        // The following table summarizes all possible ways that a 64-bit Windows operating system or WOW64 handles uncaught exceptions.
 +                        // 1. The system suppresses any uncaught exceptions.
 +                        // 2. The system first terminates the process, and then the Program Compatibility Assistant (PCA) offers to fix it the next time 
 +                        // you run the application. You can disable the PCA mitigation by adding a Compatibility section to the application manifest.
 +                        // 3. The system calls the exception filters but suppresses any uncaught exceptions when it leaves the callback scope, 
 +                        // without invoking the associated handlers.
 +                        // Behavior type 2 only applies to the 64-bit version of the Windows 7 operating system.
 +                        
 +                        // NOTE: tests on Win8 box showed that 64 bit version of the Windows 8 always apply type 2 behavior
 +
 +                        // Effectively this means that when StopProcessing exception is raised from ThreadException callback - it won't be intercepted in DriveFsiEventLoop.
 +                        // Instead it will be interpreted as unhandled exception and crash the whole process.
 +
 +                        // FIX: detect if current process in 64 bit running on Windows 7 or Windows 8 and if yes - swallow the StopProcessing and ScheduleRestart instead.
 +                        // Visible behavior should not be different, previosuly exception unwinds the stack and aborts currently running Application.
 +                        // After that it will be intercepted and suppressed in DriveFsiEventLoop.
 +                        // Now we explicitly shut down Application so after execution of callback will be completed the control flow 
 +                        // will also go out of WinFormsEventLoop.Run and again get to DriveFsiEventLoop => restart the loop. I'd like the fix to be  as conservative as possible
 +                        // so we use special case for problematic case instead of just always scheduling restart.
 +
 +                        // http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
 +                        let os = Environment.OSVersion
 +                        // Win7 6.1
 +                        let isWindows7 = os.Version.Major = 6 && os.Version.Minor = 1
 +                        // Win8 6.2
 +                        let isWindows8Plus = os.Version >= Version(6, 2, 0, 0)
 +                        if isFromThreadException && ((isWindows7 && Environment.Is64BitProcess) || (Environment.Is64BitOperatingSystem && isWindows8Plus))
 +#if DEBUG
 +                            // for debug purposes
 +                            && Environment.GetEnvironmentVariable("FSI_SCHEDULE_RESTART_WITH_ERRORS") = null
 +#endif
 +                        then
 +                            fsi.EventLoop.ScheduleRestart()
 +                        else
 +                            reraise()
                  )
  
+ 
          if fsiOptions.Interact then 
+ 
+             if !progress then fprintfn fsiConsoleOutput.Out "Run: Interact..."
              // page in the type check env 
              istateRef := fsiInteractionProcessor.LoadDummyInteraction !istateRef
              if !progress then fprintfn fsiConsoleOutput.Out "MAIN: InstallKillThread!";
@@@ -2524,35 -2517,97 +2583,124 @@@
          // to be explicitly kept alive.
          GC.KeepAlive fsiInterruptController.EventHandlers
  
 -#endif // SILVERLIGHT
 +   
  
 +let MainMain (argv:string[]) = 
 +    ignore argv
 +    let argv = System.Environment.GetCommandLineArgs()
 +
 +    // When VFSI is running, set the input/output encoding to UTF8.
 +    // Otherwise, unicode gets lost during redirection.
 +    // It is required only under Net4.5 or above (with unicode console feature).
 +    if FSharpEnvironment.IsRunningOnNetFx45OrAbove && 
 +        argv |> Array.exists (fun x -> x.Contains "fsi-server") then
 +        Console.InputEncoding <- System.Text.Encoding.UTF8 
 +        Console.OutputEncoding <- System.Text.Encoding.UTF8
 +
 +#if DEBUG  
 +    if argv |> Array.exists  (fun x -> x = "/pause" || x = "--pause") then 
 +        Console.WriteLine("Press any key to continue...")
 +        Console.ReadKey() |> ignore
 +
 +    try
 +      let fsi = FsiEvaluationSession (argv, Console.In, Console.Out, Console.Error)
 +      fsi.Run() 
 +    with e -> printf "Exception by fsi.exe:\n%+A\n" e
 +#else
 +    let fsi = FsiEvaluationSession (argv, Console.In, Console.Out, Console.Error)
 +    fsi.Run() 
 +#endif
  
 +    0
  
+ /// Defines a read-only input stream used to feed content to the hosted F# Interactive dynamic compiler.
+ [<AllowNullLiteral>]
+ type CompilerInputStream() = 
+     inherit Stream()
+     // Duration (in milliseconds) of the pause in the loop of waitForAtLeastOneByte. 
+     let pauseDuration = 100
+ 
+     // Queue of characters waiting to be read.
+     let readQueue = new Queue<byte>()
+ 
+     let  waitForAtLeastOneByte(count : int) =
+         let rec loop() = 
+             let attempt = 
+                 lock readQueue (fun () ->
+                     let n = readQueue.Count
+                     if (n >= 1) then 
+                         let lengthToRead = if (n < count) then n else count
+                         let ret = Array.zeroCreate lengthToRead
+                         for i in 0 .. lengthToRead - 1 do
+                             ret.[i] <- readQueue.Dequeue()
 -
+                         Some ret
+                     else 
+                         None)
+             match attempt with 
+             | None -> System.Threading.Thread.Sleep(pauseDuration); loop()
+             | Some res -> res
+         loop() 
+ 
+     override x.CanRead = true 
+     override x.CanWrite = false
+     override x.CanSeek = false
+     override x.Position with get() = raise (NotSupportedException()) and set _v = raise (NotSupportedException())
+     override x.Length = raise (NotSupportedException()) 
+     override x.Flush() = ()
+     override x.Seek(_offset, _origin) = raise (NotSupportedException()) 
+     override x.SetLength(_value) = raise (NotSupportedException()) 
+     override x.Write(_buffer, _offset, _count) = raise (NotSupportedException("Cannot write to input stream")) 
+     override x.Read(buffer, offset, count) = 
+         let bytes = waitForAtLeastOneByte count
+         Array.Copy(bytes, 0, buffer, offset, bytes.Length)
+         bytes.Length
+ 
+     /// Feeds content into the stream.
+     member x.Add(str:string) =
+         if (System.String.IsNullOrEmpty(str)) then () else
+ 
+         lock readQueue (fun () -> 
+             let bytes = System.Text.Encoding.UTF8.GetBytes(str)
+             for i in 0 .. bytes.Length - 1 do
+                 readQueue.Enqueue(bytes.[i]))
+ 
+ 
+ 
+ /// Defines a write-only stream used to capture output of the hosted F# Interactive dynamic compiler.
+ [<AllowNullLiteral>]
+ type CompilerOutputStream()  =
+     inherit Stream()
+     // Queue of characters waiting to be read.
+     let contentQueue = new Queue<byte>()
+     let nyi() = raise (NotSupportedException())
+ 
+     override x.CanRead = false
+     override x.CanWrite = true
+     override x.CanSeek = false
+     override x.Position with get() = nyi() and set _v = nyi()
+     override x.Length = nyi() 
+     override x.Flush() = ()
+     override x.Seek(_offset, _origin) = nyi() 
+     override x.SetLength(_value) = nyi() 
+     override x.Read(_buffer, _offset, _count) = raise (NotSupportedException("Cannot write to input stream")) 
+     override x.Write(buffer, offset, count) = 
+         let stop = offset + count
+         if (stop > buffer.Length) then raise (ArgumentException("offset,count"))
+ 
+         lock contentQueue (fun () -> 
+             for i in offset .. stop - 1 do
+                 contentQueue.Enqueue(buffer.[i]))
+ 
+     member x.Read() = 
+         lock contentQueue (fun () -> 
+             let n = contentQueue.Count
+             if (n > 0) then 
+                 let bytes = Array.zeroCreate n
+                 for i in 0 .. n-1 do 
+                     bytes.[i] <- contentQueue.Dequeue()   
+ 
+                 System.Text.Encoding.UTF8.GetString(bytes, 0, n)
+             else
+                 "")
 +
 +#endif // SILVERLIGHT
diff --cc src/fsharp/fsiAnyCpu/fsiAnyCPU.exe.config
index 10ef015,694b0ff..e48f68f
--- a/src/fsharp/fsiAnyCpu/fsiAnyCPU.exe.config
+++ b/src/fsharp/fsiAnyCpu/fsiAnyCPU.exe.config
@@@ -10,24 -10,16 +10,30 @@@
            culture="neutral"/>
          <bindingRedirect
            oldVersion="2.0.0.0"
 -          newVersion="4.3.0.0"/>
 +          newVersion="4.3.1.0"/>
          <bindingRedirect
+           oldVersion="2.3.0.0"
+           newVersion="4.3.0.0"/>
+         <bindingRedirect
+           oldVersion="2.3.5.0"
+           newVersion="4.3.0.0"/>
+         <bindingRedirect
            oldVersion="4.0.0.0"
 -          newVersion="4.3.0.0"/>
 +          newVersion="4.3.1.0"/>
 +        <bindingRedirect
 +          oldVersion="4.3.0.0"
 +          newVersion="4.3.1.0"/>
 +        <!-- Old style portable -->
 +        <bindingRedirect
 +          oldVersion="2.3.5.0"
 +          newVersion="4.3.1.0"/>
 +        <bindingRedirect
 +          oldVersion="2.3.5.1"
 +          newVersion="4.3.1.0"/>
 +        <!-- .NETCore portable -->
 +        <bindingRedirect
 +          oldVersion="3.3.1.0"
 +          newVersion="4.3.1.0"/>
        </dependentAssembly>
      </assemblyBinding>
    </runtime>
diff --cc src/fsharp/ilxgen.fs
index 3b380bc,52a2108..646bbfe
--- a/src/fsharp/ilxgen.fs
+++ b/src/fsharp/ilxgen.fs
@@@ -4808,10 -4806,14 +4808,9 @@@ and GenBindAfterSequencePoint cenv cgbu
  
              let ilFieldDef = 
                  { ilFieldDef with 
 -                   CustomAttrs = 
 -                       if cenv.g.ilg.generateDebugBrowsableData then 
 -                           mkILCustomAttrs (ilAttribs @ [ mkDebuggerBrowsableNeverAttribute cenv.g.ilg ])
 -                       else 
 -                           mkILCustomAttrs ilAttribs }
 +                   CustomAttrs = mkILCustomAttrs (ilAttribs @ [ cenv.g.ilg.mkDebuggerBrowsableNeverAttribute() ]) }
- 
              [ (fspec.EnclosingTypeRef, ilFieldDef) ]
            
 -
          let ilTypeRefForProperty = ilTyForProperty.TypeRef
  
          for (tref,ilFieldDef) in ilFieldDefs do
diff --cc src/fsharp/policy.2.0.FSharp.Core/policy.2.0.FSharp.Core.dll.config
index 0000000,0ed3362..14bf651
mode 000000,100644..100644
--- a/src/fsharp/policy.2.0.FSharp.Core/policy.2.0.FSharp.Core.dll.config
+++ b/src/fsharp/policy.2.0.FSharp.Core/policy.2.0.FSharp.Core.dll.config
@@@ -1,0 -1,17 +1,17 @@@
+ <?xml version="1.0" encoding="utf-8" ?>
+ <configuration>
+    <runtime>
+       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727">
+          <dependentAssembly>
+             <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" processorArchitecture="msil" Culture="neutral" />
 -            <bindingRedirect oldVersion="2.0.0.0" newVersion="2.3.0.0" />
++            <bindingRedirect oldVersion="2.0.0.0" newVersion="2.3.1.0" />
+          </dependentAssembly>
+       </assemblyBinding>
+       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v4.0.30319">
+          <dependentAssembly>
+             <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" processorArchitecture="msil" Culture="neutral" />
 -            <bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0" />
++            <bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.1.0" />
+          </dependentAssembly>
+       </assemblyBinding>
+    </runtime>
+ </configuration> 
diff --cc src/fsharp/policy.2.3.FSharp.Core/policy.2.3.FSharp.Core.dll.config
index 0000000,6a65bb4..9c66175
mode 000000,100644..100644
--- a/src/fsharp/policy.2.3.FSharp.Core/policy.2.3.FSharp.Core.dll.config
+++ b/src/fsharp/policy.2.3.FSharp.Core/policy.2.3.FSharp.Core.dll.config
@@@ -1,0 -1,18 +1,21 @@@
+ <?xml version="1.0" encoding="utf-8" ?>
+ <configuration>
+    <runtime>
+       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727">
+          <dependentAssembly>
+             <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" processorArchitecture="msil" Culture="neutral" />
 -            <bindingRedirect oldVersion="2.3.5.0" newVersion="2.3.0.0" />
++            <bindingRedirect oldVersion="2.3.5.0" newVersion="2.3.1.0" />
++            <bindingRedirect oldVersion="2.3.5.1" newVersion="2.3.1.0" />
+          </dependentAssembly>
+       </assemblyBinding>
+       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v4.0.30319">
+          <dependentAssembly>
+             <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" processorArchitecture="msil" Culture="neutral" />
 -            <bindingRedirect oldVersion="2.3.0.0" newVersion="4.3.0.0" />
 -            <bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.0.0" />
++            <bindingRedirect oldVersion="2.3.0.0" newVersion="4.3.1.0" />
++            <bindingRedirect oldVersion="2.3.1.0" newVersion="4.3.1.0" />
++            <bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.1.0" />
++            <bindingRedirect oldVersion="2.3.5.1" newVersion="4.3.1.0" />
+          </dependentAssembly>
+       </assemblyBinding>
+    </runtime>
+ </configuration> 
diff --cc src/fsharp/policy.4.0.FSharp.Core/policy.4.0.FSharp.Core.dll.config
index 0000000,b279a6f..0b6856e
mode 000000,100644..100644
--- a/src/fsharp/policy.4.0.FSharp.Core/policy.4.0.FSharp.Core.dll.config
+++ b/src/fsharp/policy.4.0.FSharp.Core/policy.4.0.FSharp.Core.dll.config
@@@ -1,0 -1,11 +1,11 @@@
+ <?xml version="1.0" encoding="utf-8" ?>
+ <configuration>
+    <runtime>
+       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+          <dependentAssembly>
+             <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" processorArchitecture="msil" Culture="neutral" />
 -            <bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0" />
++            <bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.1.0" />
+          </dependentAssembly>
+       </assemblyBinding>
+    </runtime>
+ </configuration> 
diff --cc src/fsharp/policy.4.3.FSharp.Core/policy.4.3.FSharp.Core.dll.config
index 0000000,436a9dc..3e3e956
mode 000000,100644..100644
--- a/src/fsharp/policy.4.3.FSharp.Core/policy.4.3.FSharp.Core.dll.config
+++ b/src/fsharp/policy.4.3.FSharp.Core/policy.4.3.FSharp.Core.dll.config
@@@ -1,0 -1,11 +1,11 @@@
+ <?xml version="1.0" encoding="utf-8" ?>
+ <configuration>
+    <runtime>
+       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+          <dependentAssembly>
+             <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" processorArchitecture="msil" Culture="neutral" />
 -            <bindingRedirect oldVersion="4.3.5.0" newVersion="4.3.0.0" />
++            <bindingRedirect oldVersion="4.3.0.0" newVersion="4.3.1.0" />
+          </dependentAssembly>
+       </assemblyBinding>
+    </runtime>
+ </configuration> 
diff --cc src/fsharp/vs/IncrementalBuild.fs
index 91de41e,261b607..c65f1d1
--- a/src/fsharp/vs/IncrementalBuild.fs
+++ b/src/fsharp/vs/IncrementalBuild.fs
@@@ -1673,8 -1673,8 +1673,8 @@@ module internal IncrementalFSharpBuild 
  
              /// Create a type-check configuration
              let tcConfigB = 
-                 let defaultFSharpBinariesDir = Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler.Value
+                 let defaultFSharpBinariesDir = Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(None).Value
 -    
 +                    
                  // see also fsc.fs:runFromCommandLineToImportingAssemblies(), as there are many similarities to where the PS creates a tcConfigB
                  let tcConfigB = 
                      TcConfigBuilder.CreateNew(defaultFSharpBinariesDir, implicitIncludeDir=projectDirectory, 
diff --cc src/fsharp/vs/ServiceDeclarations.fs
index 4658c07,fd705b3..85b7a34
mode 100755,100644..100644
--- a/src/fsharp/vs/ServiceDeclarations.fs
+++ b/src/fsharp/vs/ServiceDeclarations.fs
diff --cc src/fsharp/vs/service.fs
index 5f36b04,c76eee2..b0b3332
--- a/src/fsharp/vs/service.fs
+++ b/src/fsharp/vs/service.fs
@@@ -286,11 -281,13 +288,12 @@@ type MethodOverloads( name: string, uns
      member x.Name = name
      member x.Methods = methods
  
 -    static member Create(infoReader:InfoReader,m,denv,items) = 
 +    static member Create(infoReader:InfoReader,m,denv,items:Item list) = 
          let g = infoReader.g
 -        if verbose then dprintf "mkMethods: %d items on input\n" (List.length items) 
          if isNil items then new MethodOverloads("", [| |]) else
 -        let name = DisplayNameOfItem g items.Head 
 +        let name = items.Head.DisplayName g 
          let getOverloadsForItem item =
+ #if FX_ATLEAST_40
              match methodOverloadsCache.TryGetValue item with
              | true, overloads -> overloads
              | false, _ ->
diff --cc src/source-build-version
index 7b9cc56,7b9cc56..0000000
deleted file mode 100755,100755
--- a/src/source-build-version
+++ /dev/null
@@@ -1,1 -1,1 +1,0 @@@
--2.9.9.999
diff --cc src/source-build-version-2.3.0.0
index e7a4af9,e7a4af9..0000000
deleted file mode 100755,100755
--- a/src/source-build-version-2.3.0.0
+++ /dev/null
@@@ -1,1 -1,1 +1,0 @@@
--2.3.0.0
diff --cc src/source-build-version-2.3.5.0
index bb2f148,bb2f148..0000000
deleted file mode 100755,100755
--- a/src/source-build-version-2.3.5.0
+++ /dev/null
@@@ -1,1 -1,1 +1,0 @@@
--2.3.5.0
diff --cc src/source-build-version-4.3.0.0
index 61e257a,61e257a..0000000
deleted file mode 100755,100755
--- a/src/source-build-version-4.3.0.0
+++ /dev/null
@@@ -1,1 -1,1 +1,0 @@@
--4.3.0.0
diff --cc src/utils/CompilerLocationUtils.fs
index cf321bb,3a90fe8..c118fb0
--- a/src/utils/CompilerLocationUtils.fs
+++ b/src/utils/CompilerLocationUtils.fs
@@@ -203,48 -191,107 +203,107 @@@ module internal FSharpEnvironment 
      //     - default location of fsi.exe in FSharp.VS.FSI.dll
      //     - default location of fsc.exe in FSharp.Compiler.CodeDom.dll
      //     - default F# binaries directory in (project system) Project.fs
-     let BinFolderOfDefaultFSharpCompiler = 
-         // Check for an app.config setting to redirect the default compiler location
-         // Like fsharp-compiler-location
-         try 
-             let result = tryAppConfig "fsharp-compiler-location"
-             match result with 
-             | Some _ ->  result 
-             | None -> 
- 
-                 // Note: If the keys below change, be sure to update code in:
-                 // Property pages (ApplicationPropPage.vb)
- 
-                 let key20 = @"Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.FSharp-" + FSharpTeamVersionNumber 
- #if FX_ATLEAST_45
-                 let key40 = @"Software\Microsoft\FSharp\3.1\Runtime\v4.0"
- #else
-                 let key40 = @"Software\Microsoft\FSharp\2.0\Runtime\v4.0"
- #endif
-                 let key1,key2 = 
-                     match FSharpCoreLibRunningVersion with 
-                     | None -> key20,key40 
-                     | Some v -> if v.Length > 1 && v.[0] <= '3' then key20,key40 else key40,key20
+     
+       /// Try to find the F# compiler location by looking at the "fsharpi" script installed by F# packages
+     let internal tryFsharpiScript(url:string) =
+       try
+         let str = File.ReadAllText(url)
+         let reg = new System.Text.RegularExpressions.Regex("mono.* (\/.*)\/fsi\.exe")
+         let res = reg.Match(str)
+         if res.Success then Some(res.Groups.[1].Value) else None
+       with e -> 
+         None
+ 
+ 
+     let BackupInstallationProbePoints = 
+       [ // prefer the latest installation of Mono on Mac
+         "/Library/Frameworks/Mono.framework/Versions/Current"
+         // prefer freshly built F# compilers on Linux
+         "/usr/local"
+         // otherwise look in the standard place
+         "/usr" ]
+ 
+     let safeExists f = (try File.Exists(f) with _ -> false)
+ 
+ 
+     // The default location of FSharp.Core.dll and fsc.exe based on the version of fsc.exe that is running
+   // Used for
+   //   - location of design-time copies of FSharp.Core.dll and FSharp.Compiler.Interactive.Settings.dll for the default assumed environment for scripts
+   //   - default ToolPath in tasks in FSharp.Build.dll (for Fsc tasks)
+   //   - default F# binaries directory in service.fs (REVIEW: check this)
+   //   - default location of fsi.exe in FSharp.VS.FSI.dll
+   //   - default location of fsc.exe in FSharp.Compiler.CodeDom.dll
+     let BinFolderOfDefaultFSharpCompiler(probePoint:string option) = 
+     // Check for an app.config setting to redirect the default compiler location
+     // Like fsharp-compiler-location
+      try 
+       // FSharp.Compiler support setting an appkey for compiler location. I've never seen this used.
+       //printfn "Resolution" "BinFolderOfDefaultFSharpCore: Probing app.config"
+       let result = tryAppConfig "fsharp-compiler-location"
+       match result with 
+       | Some _ ->  result 
+       | None -> 
+ 
+         // Look in the probePoint if given, e.g. look for a compiler alongside of FSharp.Build.dll
+         match probePoint with 
+         | Some p when safeExists (Path.Combine(p,"fsc.exe")) || safeExists (Path.Combine(p,"Fsc.exe")) -> Some p 
+         | _ -> 
+ 
+         // On windows the location of the compiler is via a registry key
+         let key20 = @"Software\Microsoft\FSharp\2.0\Runtime\v4.0"
 -        let key40 = @"Software\Microsoft\FSharp\3.0\Runtime\v4.0"
++        let key40 = @"Software\Microsoft\FSharp\3.1\Runtime\v4.0"
+         let key1,key2 = 
+           match FSharpCoreLibRunningVersion with 
+           | None -> key40,key20 
+           | Some v -> if v.Length > 1 && v.[0] <= '3' then key20,key40 else key40,key20
+         
+         //printfn "Resolution" "BinFolderOfDefaultFSharpCore: Probing registry key %s" key1
+         let result = tryRegKey key1
+         match result with 
+         | Some _ ->  result 
+         | None -> 
+         //printfn "Resolution" "BinFolderOfDefaultFSharpCore: Probing registry key %s" key2
+         let result =  tryRegKey key2
+         match result with 
+         | Some _ ->  result 
+         | None ->
+ 
+         // On Unix we let you set FSHARP_COMILER_BIN. I've rarely seen this used and its not documented in the install isntructions.
+         //printfn "Resolution" "BinFolderOfDefaultFSharpCore: Probing environment variable FSHARP_COMPILER_BIN"
+         let result = 
+             let var = System.Environment.GetEnvironmentVariable("FSHARP_COMPILER_BIN")
+             if String.IsNullOrEmpty(var) then None
+             else Some(var)
+         match result with 
+         | Some _ -> result
+         | None -> 
+ 
+         // On Unix we probe 'bin' under various hardwired paths for the scripts 'fsharpc' and 'fsharpi'. 
+         // We then loko in the script to see the Mono location it is pointing to. 
+         // This is pretty fragile, e.g. the script lookup is done via a regular expression.
+         // Really we should just search the path or otherwise resolve the 'mono' command?
+         let result = 
+             BackupInstallationProbePoints |> List.tryPick (fun x -> 
+                //printfn "Resolution" "BinFolderOfDefaultFSharpCore: Probing  %s" x
+                let file f = Path.Combine(Path.Combine(x,"bin"),f)
+                let exists f = safeExists(file f)
+                match (if exists "fsc" && exists "fsi" then tryFsharpiScript (file "fsi") else None) with
+                | Some res -> Some res
+                | None ->
+                match (if exists "fsharpc" && exists "fsharpi" then tryFsharpiScript (file "fsharpi") else None) with
+                | Some res -> Some res
+                | None -> None)
                  
-                 let result = tryRegKey key1
-                 match result with 
-                 | Some _ ->  result 
-                 | None -> 
-                     let result =  tryRegKey key2
-                     match result with 
-                     | Some _ ->  result 
-                     | None -> 
- 
-             // This was failing on rolling build for staging because the prototype compiler doesn't have the key. Disable there.
-             #if FX_ATLEAST_40_COMPILER_LOCATION
-                         System.Diagnostics.Debug.Assert(result<>None, sprintf "Could not find location of compiler at '%s' or '%s'" key1 key2)
-             #endif                                
-                           
-                             // For the prototype compiler, we can just use the current domain
-                         tryCurrentDomain()
-         with e -> 
-             System.Diagnostics.Debug.Assert(false, "Error while determining default location of F# compiler")
-             None
+         match result with 
+         | Some _ -> result
+         | None -> 
+                // For the prototype compiler, we can just use the current domain
+                tryCurrentDomain()
+      with e -> 
+       System.Diagnostics.Debug.Assert(false, "Error while determining default location of F# compiler")
+       //printfn "Resolution" "BinFolderOfDefaultFSharpCore: error %s" (e.ToString())
+       None
+ 
  
  #endif // SILVERLIGHT
  #if FX_ATLEAST_45

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-cli-apps/packages/fsharp.git



More information about the Pkg-cli-apps-commits mailing list