Skip to content

fix: make Facet_SplitGeneratedFiles visible to the generator - #439

Open
kevin-mcmanus wants to merge 1 commit into
Tim-Maes:masterfrom
kevin-mcmanus:fix/split-generated-files-visible
Open

kevin-mcmanus wants to merge 1 commit into
Tim-Maes:masterfrom
kevin-mcmanus:fix/split-generated-files-visible

Conversation

@kevin-mcmanus

@kevin-mcmanus kevin-mcmanus commented Oct 12, 2026 •

Copy link
Copy Markdown

Facet_SplitGeneratedFiles was never listed as a CompilerVisibleProperty, so it never reached the generator as a build_property. Setting it in a .csproj or Directory.Build.props did nothing — which is the only way it is documented. docs/12_GeneratedFilesOutput.md:93 shows it as a PropertyGroup entry; the changelog says to set it "in your .csproj or Directory.Build.props". A project asking for single-file output silently kept getting the split files, with no diagnostic.

Nor was there a workaround: the generator reads build_property.* from AnalyzerConfigOptions.GlobalOptions, which only MSBuild's generated global config populates.

The fix

One line in src/Facet/Facet.props, alongside the sixteen properties already declared there:

<CompilerVisibleProperty Include="Facet_SplitGeneratedFiles" />

MSBuild then writes build_property.Facet_SplitGeneratedFiles into the generated global config, and GlobalConfigurationDefaults.FromOptions picks it up through the same path as every other Facet_* property. No generator change: the option was already honoured once it arrived. The second file in the diff is a CHANGELOG.md note.

Built the same consumer project against the package from master and from this branch. The project sets <Facet_SplitGeneratedFiles>false</Facet_SplitGeneratedFiles> in both runs, so only the package differs:

master package:  Probe.EntityDto.Properties.g.cs + Probe.EntityDto.Mappings.g.cs   <- request ignored,
                                                                                      default true wins
this branch:     Probe.EntityDto.g.cs                                              <- false honoured

The property is true by default, so split output is the normal behaviour and false is the opt-out to the pre-6.x single-file layout. The defect was that a project asking for that opt-out silently kept getting the split files.

No test: the defect is in MSBuild plumbing, and whether Facet.props is imported and its properties surfaced isn't observable from inside the test assembly. SplitOutputTests already covers the generator honouring the option once it arrives.

No test changes. The suite passes.

Checklist

  • I read the contributing guide and followed the code of conduct.
  • I added or updated tests when behavior changed.
  • I updated documentation, samples, or release notes when needed.
  • I ran dotnet test locally.
  • My change is ready for review.

The property was never listed as a CompilerVisibleProperty, so it never
reached the generator as a build_property and setting it in a .csproj or
Directory.Build.props did nothing -- which is the only way it is
documented, in docs/12_GeneratedFilesOutput.md and the changelog.

Nor was there a workaround. The generator reads build_property.* from
AnalyzerConfigOptions.GlobalOptions, which only MSBuild's generated
global config populates; a hand-written .editorconfig section sets
per-syntax-tree options, which this path never reads.

Before this, a project asking for single-file output still got
{Type}.Properties.g.cs and {Type}.Mappings.g.cs, with no diagnostic.

No test accompanies this: the defect is in MSBuild plumbing, and whether
Facet.props is imported and its properties surfaced is not observable
from inside the test assembly. SplitOutputTests already covers the
generator honouring the option once it arrives.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant