fflat 1.0.48

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global fflat --version 1.0.48
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local fflat --version 1.0.48
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=fflat&version=1.0.48
                    
nuke :add-package fflat --version 1.0.48
                    

fflat - F# native script compiler on bflat

<img alt="Nuget" src="https://img.shields.io/nuget/v/fflat">

Build 1MB native executables from .fsx scripts!

alternate text is missing from this package README image

Installation

dotnet tool install --global fflat

Basic usage

fflat script.fsx            # about 13MB, full .NET
fflat script.fsx --small    # about 2.6MB, no debug/globalization/symbols
fflat script.fsx --tiny     # about 1MB, no reflection/exceptions, no printfn!

run fflat --help for a list of options

Advanced usage

fflat ./helloworld.fsx --small build -x -r "mylibrary.dll" --os windows ## ... etc

using fflat to as an interface to the F# compiler

fflat ./mylibrary.fsx build-il --watch ## quickly recompiles mylibrary.dll on every change 
all options
❯ fflat ./helloworld.fsx build --help
Usage:
  fflat <script> [fflat options] build|build-il [<>...] [bflat options]

fflat options:
    -t, --tiny                            Smallest possible executable (adds bflat args
                                          --no-reflection --no-globalization --no-stacktrace-data
                                          --no-exception-messages --no-debug-info
                                          --separate-symbols -Os). avoid using printfn!
    -s, --small                           small executable but retains reflection, stack trace
                                          and exception messages (adds bflat args --no-debug-info
                                          --no-globalization --separate-symbols -Os)
    --output, -o <outputFile>             output executable path

bflat options:
  -d, --define <define>                    Define conditional compilation symbol(s)
  -r, --reference <file list>              Additional .NET assemblies to include
  --target <Exe|Shared|WinExe>             Build target
  -o, --out <file>                         Output file path
  -c                                       Produce object file, but don't run linker
  --ldflags <ldflags>                      Arguments to pass to the linker
  -x                                       Print the commands
  --arch <x64|arm64>                       Target architecture
  --os <linux|windows|uefi>                Target operating system
  --libc <libc>                            Target libc (Windows: shcrt|none, Linux: glibc|bionic)
  -Os, --optimize-space                    Favor code space when optimizing
  -Ot, --optimize-time                     Favor code speed when optimizing
  -O0, --no-optimization                   Disable optimizations
  --no-reflection                          Disable support for reflection
  --no-stacktrace-data                     Disable support for textual stack traces
  --no-globalization                       Disable support for globalization (use invariant mode)
  --no-exception-messages                  Disable exception messages
  --no-pie                                 Do not generate position independent executable
  --separate-symbols                       Separate debugging symbols (Linux)
  --no-debug-info                          Disable generation of debug information
  --map <file>                             Generate an object map file
  -i <library|library!function>            Bind to entrypoint statically
  --feature <Feature=[true|false]>         Set feature switch value
  -res <<file>[,<name>[,public|private]]>  Managed resource to include
  --stdlib <DotNet|None|Zero>              C# standard library to use
  --deterministic                          Produce deterministic outputs including timestamps
  --verbose                                Enable verbose logging
  --langversion <langversion>              C# language version ('latest', 'default', 'latestmajor',
                                           'preview', or version like '6' or '7.1'
  -?, -h, --help                           Show help and usage information

Common questions, troubleshooting

Why?

there is almost a 1000x difference in startup time for dotnet fsi scripts using nuget!

alternate text is missing from this package README image

there is also FSharpPacker for .fsx scripts, which compiles .fsx scripts to native executables using the standard MSBuild pipeline (PublishAOT), but bflat can produce significantly smaller executables or even omit the .NET runtime/GC all together.

TypeInitialization_Type_NoTypeAvailable errors

use --small instead of --tiny, --tiny will crash if your script uses any reflection features.

there's many untrimmable features in the F# core library like printfn, quotations and linq. substituting all printfn calls with stdout.WriteLine will produce significantly smaller binaries as well.


Have fun!

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
2.1.3 259 2/4/2026
2.1.2 164 2/4/2026
2.1.1 188 2/3/2026 2.1.1 is deprecated because it has critical bugs.
2.1.0 192 2/2/2026 2.1.0 is deprecated because it has critical bugs.
2.0.7 1,179 12/13/2024
2.0.5 691 12/13/2024
1.0.53 3,438 7/6/2024
1.0.52 3,201 7/6/2024
1.0.49 7,238 6/22/2024
1.0.48 8,546 1/30/2024
1.0.47 3,395 1/30/2024
1.0.46 11,575 11/18/2023
1.0.44 4,313 10/18/2023
1.0.43 2,654 10/9/2023
1.0.36 2,447 10/9/2023
1.0.34 1,823 10/8/2023
1.0.33 2,799 10/8/2023