Fake dotnetcore

Getting Started

Getting started with the Fake dotnetcore version is easy. Just install the corresponding package for your system:

  • Windows (chocolatey)

    • Install chocolatey (a windows package manager) if you have not installed it yet (see https://chocolatey.org). Basically open an admin cmd.exe and paste

      
      @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
      
      

    • Install fake via chocolatey

      In an admin cmd.exe enter:

          
          choco install fake -pre
          
      
    • There are other ways to get started if chocolatey / an administrator-cmd or global installation is not an option.

  • Dotnet sdk global tool

    • Install the .NET sdk (at least 2.1.300)

    • Install FAKE

          
          dotnet tool install fake-cli -g --version=5.*
          
      
  • Others

    We currently do not have packages for the various distributions, look for other ways to install fake. Please consider helping out!.

now you can use

fake --help

This is basically it. You can now execute fake commands. Follow the minimal example below for a quick start.

FAKE Template

Use the FAKE dotnet new template. See FAKE template for more information.

  • Install the template:

    
    dotnet new -i "fake-template::*"
    
  • Run the template:

    
    dotnet new fake
    

CLI

See Fake command line

Buildserver support

AppVeyor: https://github.com/fsharp/FAKE/blob/master/appveyor.yml Travis: https://github.com/fsharp/FAKE/blob/master/.travis.yml

Why?

The goals are:

  • Provide a easy to use cross platform way to use FAKE. With a good bootstrapping experience
  • Cleanup 'FakeLib'
  • Extract reusable libraries and make them usable for your projects or the fsi!
  • Make it easier to extend FAKE for your own use-case
  • Provide an easy way for simple scripting, automate everything, everywhere.

Please read https://github.com/fsharp/FAKE/issues/1232

What is the migration path?

See Fake 5 Migration Guide

How to specify dependencies?

See the FAKE 5 modules section.

Portable installation

We distrubute a dotnetcore version of FAKE without the dotnetcore runtime. This version assumes an existing dotnet sdk installation while the non-portable installation doesn't.

Just use the -portable version of the downloads, extract it and execute.

dotnet fake.dll 

The advantage of this method is that it is portable (ie. distribute the same binaries) and requires less bandwidth. The disadvantage is that you need to have a dotnet sdk installed.

Examples

  • See https://github.com/fsharp/FAKE/blob/master/build.fsx Note that with the "new" API you should call the modules directly instead of opening them. Therefore this example is actually pretty bad because it just opened everything (for minimal diff to the "normal" build.fsx)

Minimal example

Create a file named build.fsx with the following contents:

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
#r "paket:
nuget Fake.Core.Target //"
// include Fake modules, see Fake modules section

open Fake.Core

// *** Define Targets ***
Target.create "Clean" (fun _ ->
  Trace.log " --- Cleaning stuff --- "
)

Target.create "Build" (fun _ ->
  Trace.log " --- Building the app --- "
)

Target.create "Deploy" (fun _ ->
  Trace.log " --- Deploying app --- "
)

open Fake.Core.TargetOperators

// *** Define Dependencies ***
"Clean"
  ==> "Build"
  ==> "Deploy"

// *** Start Build ***
Target.runOrDefault "Deploy"

Run this file by executing


fake run build.fsx

Downloads

Get the latest packages from GitHub: https://github.com/fsharp/FAKE/releases

Get the latest binaries from chocolatey: https://chocolatey.org/packages/fake

Get the latest dotnet-fake cli tool by adding <DotNetCliToolReference Include="dotnet-fake" Version="5.*" /> to your dependencies (https://www.nuget.org/packages/dotnet-fake)