Logo Partas.TypeProvider

Project Module

Reading of MSBuild project structure for the type provider. The same split as `Git`: structure - which projects exist, where they live - is read from the solution file or the directory tree at design time, so expanding the provided types never spawns a process and never loads MSBuild into the compiler. Property *values* are read at runtime by `Runtime`, which shells out to `dotnet msbuild -getProperty`. The design-time values are deliberately approximate. They are read straight out of the project XML with no condition evaluation, and exist only to be shown in a doc comment as a hint. Nothing compiles against them.

Types and nested modules

Type/Module Description

Json

Minimal reader for the flat `{"Properties":{"Name":"value"}}` object that `dotnet msbuild -getProperty` emits. A dependency-free scanner rather than a JSON library, because the designer assembly targets netstandard2.0 and carries no runtime dependencies.

Runtime

Functions invoked from erased quotations - they run in the *consuming* program, not in the compiler, and must never throw.

ProjectRef

A project as it appears in the tree, with everything needed to name it, to point `dotnet` at it, and to find the `Directory.Build.props` above it.

Functions and values

Function or value Description

DefaultVersion

Full Usage: DefaultVersion

Returns: string

MSBuild's own default for a project that never declares ``. Worth naming, because a hint of exactly this is ambiguous - see `propertyDoc`.

Returns: string

defaultProperties

Full Usage: defaultProperties

Returns: string list

The properties given a member of their own on every provided project. The same list is requested in one batch at runtime, so adding to it costs nothing extra per member.

Returns: string list

discover root

Full Usage: discover root

Parameters:
    root : string

Returns: ProjectRef list

Every project belonging to `root`, taken from its solution file when there is one and from the directory tree otherwise. Sorted by name, and never throws: an unreadable tree yields an empty list.

root : string
Returns: ProjectRef list

hint table name

Full Usage: hint table name

Parameters:
    table : Map<string, string>
    name : string

Returns: string

The hint shown for `name`, or "" when the project does not declare it. `Version` falls back to MSBuild's default rather than to "", because that is what a runtime read will report.

table : Map<string, string>
name : string
Returns: string

hints root reference

Full Usage: hints root reference

Parameters:
Returns: Map<string, string>

Best-effort property values for a project, read from XML with no condition evaluation: the last assignment of a name wins, whatever guarded it. Good enough for a doc comment and for nothing else.

root : string
reference : ProjectRef
Returns: Map<string, string>

solutionFile root

Full Usage: solutionFile root

Parameters:
    root : string

Returns: string option

The solution file governing `root`, preferring `.slnx` over `.sln` when a repository carries both during a migration.

root : string
Returns: string option

Type something to start searching.