Partas.TypeProvider.BuildHelper 0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Partas.TypeProvider.BuildHelper --version 0.2.1
                    
NuGet\Install-Package Partas.TypeProvider.BuildHelper -Version 0.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Partas.TypeProvider.BuildHelper" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Partas.TypeProvider.BuildHelper" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Partas.TypeProvider.BuildHelper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Partas.TypeProvider.BuildHelper --version 0.2.1
                    
#r "nuget: Partas.TypeProvider.BuildHelper, 0.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Partas.TypeProvider.BuildHelper@0.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Partas.TypeProvider.BuildHelper&version=0.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Partas.TypeProvider.BuildHelper&version=0.2.1
                    
Install as a Cake Tool

Partas.TypeProvider.BuildHelper

An F# erasing type provider for build scripts and tooling. At compile time it walks your filesystem, reads .git directly, and parses your solution file. The resulting types give you IDE completion over real repo structure, and every runtime-evaluated member (SHAs, MSBuild properties) surfaces its current value as a doc-comment hint while you author — so hovering over Git.Head.Sha shows the actual commit hash, and Project.MyApp.Version shows 2.1.0, without running anything.

Suited to FAKE pipelines, Bullseye scripts, custom build CLIs — anywhere you're wiring up CI/CD in F# and want to catch path and name errors at compile time.

dotnet add package Partas.TypeProvider.BuildHelper

Setup

open Partas.TypeProvider.BuildHelper

// rootPath is relative to the consuming .fsproj, not cwd.
type Root = BuildHelperProvider<"..", capabilityFullOverride = true>

type FS      = Root.FileSystem
type Git     = Root.Git
type Project = Root.Project
Parameter Default Notes
rootPath — Relative to the consuming .fsproj; empty string = project directory
virtualPathConfig "" Indented DSL for paths that don't exist at design time
capabilityFileSystem true
capabilityGit false
capabilityProject false Requires the .NET SDK at runtime
capabilityFullOverride false Enables all three above

FileSystem

Walks the directory tree at compile time. Directories become nested types; files become static FileInfo properties. Each directory also exposes . (DirectoryInfo), GetInfo(), and ToString().

let file : FileInfo = FS.src.``MyProject``.``Program.fs``
let dir  : string   = FS.src.ToString()

VirtualFileSystem generates the same shape from an indented-text DSL — for output paths that don't exist until after the build:

type Root = BuildHelperProvider<"..", virtualPathConfig = """
artifacts/
  nupkg/
  bin/
""">
// Root.VirtualFileSystem.artifacts.nupkg — no disk presence required at compile time

Git

Reads .git directly at design time — no git binary needed during compilation. Branch names, remote names, submodule paths, and the working-tree root are baked as constants into the consuming assembly. Volatile values execute git at runtime and are cached.

Every runtime member shows its current value as a tooltip hint while you write. Hover over Git.HeadBranch.Name mid-sentence and your IDE shows main; hover over Git.Head.Sha and it shows the actual hash. This is the repo's live state surfaced without leaving the editor.

// Constants — zero runtime cost, baked at compile time:
let remote = Git.Remotes.origin.FetchUrl   // e.g. "https://github.com/org/repo.git"
let branch = Git.Branches.main.Name       // "main"
let ref    = Git.Branches.main.RefName    // "refs/heads/main"
let up     = Git.Branches.main.Upstream   // "origin/main"

// Runtime (shells git, with design-time hint in tooltip):
let sha   = Git.Branches.main.Commit      // tooltip: DesignTime Hint: 'a3f1c9...'
let head  = Git.Head.Sha
let dirty = Git.IsDirty()

if Git.HeadBranch.IsAvailable() then
    printfn "on %s" Git.HeadBranch.Name

// Revision<"expr"> — static parameter, each expression is its own type:
type Prev = Root.Git.Branches.main.Revision<"HEAD~1">
let prevSha = Prev.Sha   // tooltip shows the actual SHA at author time

Git.Run(args) executes an arbitrary read-only git command — never prompts, never touches the network, 2-second timeout, returns stdout or "".


Project

Discovers projects from the solution file (.slnx preferred over .sln, directory-walk if absent). Path members are baked as constants; MSBuild properties are evaluated at runtime via dotnet msbuild -getProperty and cached per project per process.

Hovering over Version while wiring a publish step shows the actual current version — you see 2.1.0 in the tooltip before the first dotnet pack has run.

// Constants:
let path = Project.``MyProject``.Path
let rel  = Project.``MyProject``.RelativePath

// Runtime — first call ~30s cold (SDK load); cached after:
let ver  = Project.``MyProject``.Version          // tooltip: DesignTime Hint: '2.1.0'
let tfm  = Project.``MyProject``.TargetFramework

// Arbitrary property:
let aot  = Project.``MyProject``.Property("PublishAot")

// Scaffolded command lines — returns args only, nothing executes:
let args = Project.``MyProject``.Pack(["--no-build"])
// → ["pack"; "/path/to/MyProject.fsproj"; "--no-build"]

// Clear the per-process cache if a build changes the project mid-run:
Project.``MyProject``.Invalidate()

Built-in property members: Version, TargetFramework, TargetFrameworks, AssemblyName, RootNamespace, OutputType, PackageId, IsPackable.


Cautions

Everything is a compile-time snapshot. New branches, files, and projects don't appear until you rebuild the consuming project.

Property hints skip condition evaluation. Hints are extracted from raw project XML. A property inside <Condition="'$(Configuration)'=='Release'"> may show the wrong value. The runtime result from dotnet msbuild is always authoritative.

Version hint 1.0.0 is ambiguous. That is also the MSBuild default, so it may mean the property is undeclared rather than set explicitly. The tooltip calls this out.

capabilityProject requires the SDK at runtime. Without it, every property returns "". Check Project.IsDotnetAvailable() when deployment context is uncertain.

Annotated tag .Commit is the tag object, not the commit. Use Git.Run("rev-parse v1.0.0^{}") to peel it.

Detached or unborn HEAD. HeadBranch.* and Head.* expose IsAvailable() — check it before reading commit data.

Ref names with backticks are silently dropped. They cannot be expressed as F# identifiers and are excluded at design time with no diagnostic.


Build CLI

dotnet run --project Build.fsproj -- build
dotnet run --project Build.fsproj -- test
dotnet run --project Build.fsproj -- pack
dotnet run --project Build.fsproj -- publish --nuget-key KEY
dotnet run --project Build.fsproj -- publish local

Acknowledgements

The FileSystem and VirtualFileSystem providers are based on EasyBuild.FileSystemProvider.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.5 376 8/27/2026
0.2.4 98 8/27/2026
0.2.3 97 8/27/2026
0.2.2 136 8/25/2026
0.2.1 94 8/25/2026
0.2.0 101 8/24/2026
0.1.1 113 8/24/2026
0.1.0 100 8/24/2026