https://github.com/kant2002/fsharppacker
Packs FSX files into executable
https://github.com/kant2002/fsharppacker
hacktoberfest
Last synced: over 1 year ago
JSON representation
Packs FSX files into executable
- Host: GitHub
- URL: https://github.com/kant2002/fsharppacker
- Owner: kant2002
- License: mit
- Created: 2022-09-20T18:14:32.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-01T13:15:01.000Z (over 1 year ago)
- Last Synced: 2025-03-30T06:08:43.473Z (over 1 year ago)
- Topics: hacktoberfest
- Language: Nix
- Homepage:
- Size: 75.2 KB
- Stars: 110
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
FSharp Packer
=============
This tool allows package FSX files as self-contained executables.
Installation:
```shell
dotnet tool install --global FSharpPacker
```
### [Nix](https://nixos.org/manual/nix/stable/) (Nix/NixOS)
Nix w/ [Flakes](https://nixos.wiki/wiki/Flakes)
```
nix profile install github:kant2002/FSharpPacker
```
Run without installing
```
nix run github:kant2002/FSharpPacker -- --help
```
# Usage
USAGE: `fspack [--help] [--framework ] [--verbose] [--noselfcontained] [--aot] `
FILE:
.fsx file to convert to executable file
OPTIONS:
--framework, -f
Specify target framework (e.g. net6.0)
--verbose, -v Verbose output
--noselfcontained, -nsc
Don't publish as self-contained (with dotnet runtime included)
--singefile, -sf Produce single file
--aot, -aot Enable AOT-compilation
--projectref [...]
Add project references to the script, so you can use classes from them
--help display this list of options.
**Please note that the app is produced as self-contained by default.**
Simple usage:
```shell
fspack fsx-file.fsx []
```
For example:
```shell
fspack FSharpPacker.Tests\Samples\LoadFile.fsx -o test -r win-x64
test\LoadFile.exe
```
for AOT build
```shell
fspack FSharpPacker.Tests\Samples\LoadFile.fsx -aot -o test-aot -r win-x64 -f net7.0
test-aot\LoadFile.exe
```
Self-contained with dotnet 7 and a single-file executable:
```shell
fspack FSharpPacker.Tests/Samples/LoadFile.fsx -o test-single-file -r win-x64 -f net7.0 -sf -p:EnableCompressionInSingleFile=true
test-single-file\LoadFile.exe
```
## Extensions
You can specify project reference using `--projectref` option. There can be more then one project references.
Also script now supported [DependencyManager.FsProj](https://github.com/ThisFunctionalTom/DependencyManager.FsProj) extension which allow you specify `#r "fsproj: test.fsproj"` inside FSX file.
# Supported FSX directives
| Directive | Status | Notes |
| --------- | ------- | -----
| #load | :white_check_mark: | |
| #r "path\file.dll" | :white_check_mark: | |
| #r "nuget: package" | :white_check_mark: | |
| #r "nuget: package, version" | :white_check_mark: | |
| #r "fsproj: custom-path-search-hint" | :white_large_square: | |
| #load | :white_check_mark: | |
| #i "nuget: source-feed" | :white_check_mark: | |
| #quit | :white_check_mark: | |
| #r "custom: custom-path" | :white_large_square: | This is tricky and require deep involvement with FSharp.Compiler.Services |
| #I "custom: custom-path-search-hint" | :white_large_square: | |
# Ignored FSX directives
| Directive |
| --------- |
| #help |
| #time |
# Producing Nuget package
```shell
dotnet pack FSharpPacker.FSharp -c Release
dotnet tool install FSharpPacker --global --add-source FSharpPacker.FSharp\bin\Release\
```
```shell
dotnet tool uninstall -g FSharpPacker
```