Skip to content

chore: centralize doc-gen in Directory.Build.targets, align CI with plumber - #13

Merged
marklauter merged 1 commit into
mainfrom
build-targets
Jul 14, 2026
Merged

chore: centralize doc-gen in Directory.Build.targets, align CI with plumber#13
marklauter merged 1 commit into
mainfrom
build-targets

Conversation

@marklauter

Copy link
Copy Markdown
Owner

Brings pool current with plumber, the canonical NuGet-library pattern.

Directory.Build.targets

Documentation generation moves from a per-project <GenerateDocumentationFile> in src/Pool/Pool.csproj to a repo-wide rule in Directory.Build.targets.

It has to be a .targets file, not .props: the condition tests IsTestProject, OutputType, and IsPackable, which each project sets in its own body. .props is imported before that body, so those properties would still be empty and every condition would misfire. .targets is imported after.

The condition carries an IsPackable guard beyond plumber's copy:

Condition="'$(IsTestProject)' != 'true' and '$(OutputType)' != 'Exe' and '$(IsPackable)' != 'false'"

Plumber's version excludes only tests and executables. Applied to pool verbatim it fails the build — samples/Smtp.Pool is IsPackable=false but is a library, so it picks up doc-gen and errors CS1591 on SmtpConnection.Dispose() under TreatWarningsAsErrors. Packages document themselves; samples don't. This variant is already in lexi.

Net effect on the shipped package is nil — MSL.Pool was already generating docs. This centralizes the rule so new packable projects inherit it.

CI alignment with plumber

  • name .NET Test.NET Tests; job teststest
  • path filters gain Directory.Build.targets and .gitattributes
  • explicit dotnet restore, then build/test with --no-restore off the root solution
  • pack the solution rather than the csproj — IsPackable already scopes it to MSL.Pool
  • coverage artifact pinned to tests/Pool.Tests/ rather than a tests/** glob
  • .github/actions/setup-dotnet/action.yml now byte-identical to plumber's

Pool.slnx contains only the library, its unit tests, and the sample. The Docker-dependent integration suite lives in samples/Smtp.Pool.slnx and stays out of CI — bare dotnet build resolves the root solution, so that exclusion is preserved.

Encoding fix

dotnet.tests.yml and dotnet.publish.yml each carried a cp1252 0x97 byte where an em dash belongs — not valid UTF-8. Both re-encoded.

Verification

  • dotnet format --verify-no-changes clean
  • 144 tests pass in Debug and Release; coverage ratchet (95/90/95) satisfied
  • packed nupkg contains lib/net10.0/Pool.xml (50 KB) and packs only MSL.Pool

🤖 Generated with Claude Code

…lumber

Adopt the canonical Directory.Build.targets so documentation generation is a
repo-wide rule rather than a per-project setting. Doc-gen is imported at the
bottom of every project, where IsTestProject/OutputType/IsPackable are already
set by the project body — a condition that cannot work from Directory.Build.props,
which is imported before them.

The condition carries an IsPackable guard beyond plumber's copy. Without it,
samples/Smtp.Pool (IsPackable=false, but a library rather than an Exe) picks up
doc-gen and fails CS1591 on SmtpConnection.Dispose() under TreatWarningsAsErrors.
Packages document themselves; samples do not.

Align CI with plumber, the canonical NuGet-library pattern:
- workflow name ".NET Test" -> ".NET Tests"; job "tests" -> "test"
- add Directory.Build.targets and .gitattributes to the path filters, so a
  change to either actually triggers the test workflow
- restore explicitly, then build/test with --no-restore off the root solution
- pack the solution rather than the csproj; IsPackable already scopes it to
  MSL.Pool
- pin the coverage artifact to tests/Pool.Tests rather than a tests/** glob

Re-encode dotnet.tests.yml and dotnet.publish.yml as valid UTF-8. Both carried a
cp1252 0x97 byte where an em dash belongs, which is not valid UTF-8.

Verified: format clean, 144 tests pass in Debug and Release, and the packed
nupkg contains lib/net10.0/Pool.xml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@marklauter
marklauter merged commit 67d76f3 into main Jul 14, 2026
7 checks passed
@marklauter
marklauter deleted the build-targets branch July 14, 2026 23:06
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