{"id":21453660,"url":"https://github.com/queil/fsc-host","last_synced_at":"2026-02-23T15:02:53.539Z","repository":{"id":40992923,"uuid":"378956881","full_name":"queil/fsc-host","owner":"queil","description":"Extend your F# apps with F# scripts","archived":false,"fork":false,"pushed_at":"2026-01-23T12:23:34.000Z","size":333,"stargazers_count":28,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-24T03:43:17.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/queil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-06-21T14:22:04.000Z","updated_at":"2026-01-23T12:21:05.000Z","dependencies_parsed_at":"2025-07-14T23:32:21.782Z","dependency_job_id":"b8f777f0-3cfc-49ec-b719-71254a887da8","html_url":"https://github.com/queil/fsc-host","commit_stats":null,"previous_names":[],"tags_count":96,"template":false,"template_full_name":null,"purl":"pkg:github/queil/fsc-host","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queil%2Ffsc-host","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queil%2Ffsc-host/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queil%2Ffsc-host/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queil%2Ffsc-host/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/queil","download_url":"https://codeload.github.com/queil/fsc-host/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/queil%2Ffsc-host/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29651971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T04:40:42.915Z","updated_at":"2026-02-20T14:02:04.585Z","avatar_url":"https://github.com/queil.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fsc-host [![Build Status](https://dev.azure.com/queil/fsc-host/_apis/build/status/queil.fsc-host?branchName=main)](https://dev.azure.com/queil/fsc-host/_build/latest?definitionId=3\u0026branchName=main)  [![NuGet Badge](https://buildstats.info/nuget/Queil.FSharp.FscHost?includePreReleases=true)](https://www.nuget.org/packages/Queil.FSharp.FscHost) [![Coverage](https://img.shields.io/azure-devops/coverage/queil/fsc-host/3?style=flat)](https://img.shields.io/azure-devops/coverage/queil/fsc-host/3?style=plastic)\n\n## Extend your F# apps with F# scripts\n\nYou can easily extend your applications by calling functions and retrieving values on run time from dynamically compiled scripts. A bare minimum example (Plugin API):\n\n##### plugins/default/plugin.fsx (Plugin)\n```fsharp\nlet plugin (s:string) = printfn $\"HELLO: %s{s}\"\n```\n##### Program.fs (Host)\n```fsharp\nlet myWriter =\n  plugin\u003cstring -\u003e unit\u003e {\n    load\n  } |\u003e Async.RunSynchronously\n\nmyWriter $\"I hereby send the message\"\n```\n##### Output\n\n```\nHELLO: I hereby send the message\n```\n## What is supported\n\n* Accessing script members on the host side in a strongly-typed way (please note: if the members are not of expected types they will fail casting causing a runtime exception - there is no magic that could fix it)   \n* Consuming values and functions (including generics)\n* Referencing other scripts and dlls via `#r`\n* Referencing NuGet packages via the [`#r \"nuget: ...` directive](https://docs.microsoft.com/en-us/dotnet/fsharp/tools/fsharp-interactive/#referencing-packages-in-f-interactive)\n* Paket support via the `#r \"paket: ...\"` directive\n* Controlling compilation options\n* Full assembly caching (opt-in via options)\n* Basic logging (by passing a logging func via options)\n\n## Requirements\n\n* .NET SDK (it is convenient to package apps using `fsc-host` as Docker images)\n\n## Warning\n\nThis project is still in v0 which means the public API hasn't stabilised yet and breaking changes may happen between minor versions. Breaking changes are indicated in the release notes in GitHub releases. \n\n## Example (Basic API)\n\n1. Create a console app and add the package\n\n```sh\ndotnet new console -lang F# --name fsc-host-test \u0026\u0026 cd fsc-host-test \u0026\u0026 dotnet add package Queil.FSharp.FscHost --version 0.16.0\n```\n\n2. Save the below as `script.fsx`:\n\n```fsharp\nlet helloFromScript name = sprintf \"HELLO FROM THE SCRIPT, %s\" name\n\nlet myPrimes = [2; 3; 5]\n```\n\n2. In your `Program.cs`:\n\n```fsharp\nopen Queil.FSharp.FscHost\n\ntry\n\n  // compile a script and retrieve two properties out of it\n  let getScriptProperties () =\n    File \"script.fsx\"\n    |\u003e CompilerHost.getMember2 Options.Default\n         (Member\u003cstring -\u003e string\u003e.Path \"Script.helloFromScript\")\n         (Member\u003cint list\u003e.Path \"Script.myPrimes\")\n\n  let (helloWorld, primesOfTheDay) = getScriptProperties () |\u003e Async.RunSynchronously\n\n  let myName = \"Console Example\"\n\n  myName |\u003e helloWorld |\u003e printfn \"%s\"\n\n  printfn \"Primes of the day: \"\n  primesOfTheDay |\u003e Seq.iter (printfn \"%i\")\n\nwith\n// you can handle more exceptions from the CompilerHost here\n| ScriptMemberNotFound(name, foundMembers) -\u003e\n  printfn \"Couldn't find member: '%s'\" name\n  printfn \"Found members: \"\n  foundMembers |\u003e Seq.iter(printfn \"%s\")\n\n```\n\n3. You should get the following output when `dotnet run`:\n\n```\nHELLO FROM THE SCRIPT, Console Example\nPrimes of the day: \n2\n3\n5\n\n```\n\n## APIs\n\nThe public API of this library comes in three flavours:\n\n* plugin - high-level, declarative, and it's the recommended API to use.\n  [Example](examples/Plugin)\n\n* basic - the `CompilerHost.getMember` functions family. They take a script and options as the input and return a tuple of extracted member(s).\n  [Example](examples/Simple)\n\n* compile'n'extract - `CompilerHost.getAssembly` can be used to compile a script into an assembly (which is automatically loaded). Then members can be extracted with `Member.get` function. This API gives more flexibility and enables using generic functions. \n  [Example](examples/CompileAndExtract)\n\n## Known issues\n\n* it's recommended to avoid mixing `nuget:` and `paket: nuget` in `#r` directives as it may result in an error where two versions of the same assembly are resolved. If it is not possible to avoid then the top-level script should specify [NuGet-compatible resolution strategies](https://fsprojects.github.io/Paket/dependencies-file.html#Resolver-strategy-for-transitive-dependencies) for paket. I.e. `strategy: min` and `lowest_matching: true`.\n\n## Resources\n\n* [My blog post about the package](https://queil.net/2021/10/embedding-fsharp-compiler-fsc-host-nuget/)\n* [FSharp Compiler Docs](https://fsharp.github.io/fsharp-compiler-docs/)\n\n## Development\n\nFix FSharp.Core package hash locally:\n\n```sh\ndocker run --rm -it  -v $(pwd):/build -w /build  mcr.microsoft.com/dotnet/sdk:8.0 dotnet restore --force-evaluate\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueil%2Ffsc-host","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqueil%2Ffsc-host","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqueil%2Ffsc-host/lists"}