Skip to content

Ship FsToolkit.ErrorHandling as a source package #381

Closed

Description

@TheAngryByrd

Problem

Some F# projects cannot take a binary dependency on FsToolkit.ErrorHandling. Examples are libraries that must not add a package dependency for their consumers, or that need a different version of the helpers than their consumers use. Today these projects copy the source files by hand. The copy goes out of date, and nothing checks that it compiles under the project's settings.

Proposal

Ship a second NuGet package, FsToolkit.ErrorHandling.Sources. It delivers the source of src/FsToolkit.ErrorHandling as content files that compile inside the consumer's project.

  • The consumer can set the namespace (FsToolkitErrorHandlingNamespace) and the visibility (FsToolkitErrorHandlingVisibility, internal by default).
  • A FAKE target in build/build.fsproj generates the package content from the real source, in the main project's compile order. The output must be deterministic.
  • The build must prove the package: the existing test suite runs against it, and a strict consumer builds with it.

Scope: only the main package. Not IcedTasks, JobResult, or AsyncSeq.

Constraints found during the investigation

  • NuGet sorts content files by path, so F# compile order needs number prefixes.
  • NuGet adds preprocessed (.pp) files after the project's own files. F# needs them first.
  • Content files do not flow to projects that reference the consumer project.
  • A consumer module with the same full name as a package module gives FS0248. A custom namespace prevents it.
  • With internal visibility, the consumer's public API cannot expose the package types (FS0410).
  • Strict consumer settings (TreatWarningsAsErrors, Nullable, opt-in warnings) need #nowarn lines in the package files.

Automated: written by Claude Code for @TheAngryByrd.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions