Skip to content

Instantly share code, notes, and snippets.

@cloudRoutine
Last active October 18, 2015 20:59
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudRoutine/75fcf0651c740e07aa21 to your computer and use it in GitHub Desktop.
Save cloudRoutine/75fcf0651c740e07aa21 to your computer and use it in GitHub Desktop.
Build the Visual F# Compiler and Tools for .Net CoreCLR ( On Windows )

Make things easy for yourself and start by running posh as admin

If you already have dnvm installed remember to run update-self if you haven't recently

Clone and checkout the coreclr branch of Kevin Ransom's Fork of the Visual F# Compiler and Tools

Installing DNVM

You need DNVM as a starting point. DNVM enables you to acquire a (or multiple) .NET Execution Environment (DNX). DNVM is simply a script, which doesn't depend on .NET. You can install it via a PowerShell command. You can find alternate DNVM install instructions at the ASP.NET Home repo.

λ» @powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}"

You must close your command-prompt and start a new one in order for the user-wide environment variables to take effect.

You can see the currently installed DNX versions with dnvm list, which will display an empty set of installed runtimes.

λ» dnvm list

Installing a .NET Core DNX

It's easy to install the latest .NET Core-based DNX, using the dnvm install command. The -u (or -Unstable) parameter installs latest unstable version.

λ» dnvm install -r coreclr latest -u

This will install the 32-bit version of .NET Core. If you want the 64-bit version, you can specify processor architecture:

λ» dnvm install -r coreclr -arch x64 latest -u

You can see the currently installed DNX versions with dnvm list (your display may vary as new versions of the DNX are published):

λ» dnvm list
Active Version           Runtime Architecture Location                       Alias
------ -------           ------- ------------ --------                       -----
       1.0.0-beta8-15736 coreclr x64          C:\Users\Jared\.dnx\runtimes
       1.0.0-beta8-15736 coreclr x86          C:\Users\Jared\.dnx\runtimes

You can choose which of these DNXs you want to use with dnvm use, with similar arguments.

λ» dnvm use -r coreclr -arch x64 1.0.0-beta8-15736

Adding C:\Users\Jared\.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-beta8-15736\bin to process PATH

λ» dnvm list

Active Version           Runtime Architecture Location                       Alias
------ -------           ------- ------------ --------                       -----
  *    1.0.0-beta8-15736 coreclr x64          C:\Users\Jared\.dnx\runtimes
       1.0.0-beta8-15736 coreclr x86          C:\Users\Jared\.dnx\runtimes

Build FSharp for .NET Core

While in the directory you've cloned the visualfsharp repo to ( e.g. C:\Users\Jared\Github\fs-coreclr\visualfsharp ) fetch the DotNet buildtools using:

λ» .nuget\NuGet.exe restore packages.config -PackagesDirectory packages

If you have not added MSBuild to your PATH you add the dir

C:\Program Files (x86)\MSBuild\14.0\Bin

To build and pull in the corefx assemblies for nuget build coreclr using this command:

// For Debug
λ» msbuild src\fsharp\FSharp.Core\FSharp.Core.fsproj /p:TargetFramework=coreclr /t:Rebuild /p:RestorePackages=true 

// For Release
λ» msbuild src\fsharp\FSharp.Core\FSharp.Core.fsproj /p:TargetFramework=coreclr /t:Rebuild /p:RestorePackages=true  /p:Configuration=Release

otherwise build fsharp.core like this:

// For Debug
λ» msbuild src\fsharp\FSharp.Core\FSharp.Core.fsproj /p:TargetFramework=coreclr

// For Release
λ» msbuild src\fsharp\FSharp.Core\FSharp.Core.fsproj /p:TargetFramework=coreclr /p:Configuration=Release

then build the compiler with the command:

// For Debug
λ» msbuild src/fsharp-compiler-build.proj /p:TargetFramework=coreclr /t:Rebuild /p:RestorePackages=true

// For Release
λ» msbuild src/fsharp-compiler-build.proj /p:TargetFramework=coreclr /t:Rebuild /p:RestorePackages=true /p:Configuration=Release
@ctaggart
Copy link

I started a Dockerfile that we can use to troubleshoot.
https://hub.docker.com/r/ctaggart/visualfsharp/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment