Skip to content

Make Stunts.CompiledProxy the only reference a generator project needs - #361

Merged
kzu merged 3 commits into
mainfrom
feat/compiledproxy-package
Nov 29, 2026
Merged

kzu merged 3 commits into
mainfrom
feat/compiledproxy-package

Conversation

@kzu

@kzu kzu commented Nov 29, 2026

Copy link
Copy Markdown
Member

A project that builds a generator on StuntGenerator now needs nothing but the Stunts.CompiledProxy package reference. Before, it failed to compile without also referencing the Roslyn API and Stunts.CodeAnalysis (for NamingConvention).

Package changes

  • Files: lib/netstandard2.0 holds Stunts.CompiledProxy.dll and Stunts.CodeAnalysis.dll, no longer a copy of Stunts.dll.
  • Dependencies: Microsoft.CodeAnalysis.CSharp 5.0.0, and Stunts with include="compile,runtime,analyzers" (its build targets and content stay out of the generator project).
  • Build targets: turn on EnforceExtendedAnalyzerRules unless the project sets it (RS1036), suppress RS1042, and mark the reference Pack="false" so a NuGetizer-packed generator does not depend on it.
  • The Stunts package is unchanged.

It deliberately does not depend on the Stunts.CodeAnalysis package: that package embeds Stunts.dll and BCL assemblies in lib/. Consumers of an extender's generator load the Stunts assemblies from their own Stunts package, so the standalone package only has to compile the generator and run it in its tests.

The package readme and AGENTS.md describe the setup and how to validate it.

Verification

Done against freshly packed packages, with scratch projects outside the repo:

  • A netstandard2.0 project with only the package reference builds with no warnings and generates its proxies in-process.
  • An extender package (runtime in lib/, generator in tools/, depending only on Stunts) works in an app that references nothing else: the generator loads from the Stunts package's assemblies and the mock is created and intercepted.
  • ST022 and RS1035 are reported in the generator project.

There is no automated test for the package shape.

🤖 Generated with Claude Code

This pull request was created by CodeAlta.

A project that builds a generator on StuntGenerator failed to compile
with the package alone: it had no compiler API and no
Stunts.CodeAnalysis, whose NamingConvention the generator API takes.

The standalone package now carries Stunts.CodeAnalysis.dll next to
Stunts.CompiledProxy.dll, and depends on Microsoft.CodeAnalysis.CSharp
5.0 and on Stunts (assembly and analyzers) instead of embedding
Stunts.dll. Its build targets set what the compiler analyzers require
of a generator project (RS1036, RS1042), and keep the reference out of
the package a NuGetizer project ships the generator in. The package readme now shows the
resulting project file.

It does not depend on the Stunts.CodeAnalysis package, which embeds
Stunts.dll and BCL assemblies: consumers of the generator load the
Stunts assemblies from the Stunts package. That package is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: CodeAlta <noreply@codealta.io>
@kzu kzu added the enhancement New feature or request label Nov 29, 2026
@kzu
kzu enabled auto-merge (rebase) November 29, 2026 05:49
kzu and others added 2 commits November 29, 2026 02:53
The standalone package had no documentation for StuntGenerator,
ISyntaxProcessor or NamingConvention. The default in
Directory.Build.targets never applies, since the SDK sets
GenerateDocumentationFile to false before it is imported, so both
projects now set it, as Stunts and Stunts.Extensions do.

The package carries both .xml files next to their assemblies in
lib/netstandard2.0. The Stunts package keeps its layout: the
documentation stays out of tools/5.0 and analyzers/dotnet.

Also fixes the comments the compiler now checks: stale crefs and the
diagnostic summaries that sat above the wrong descriptor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: CodeAlta <noreply@codealta.io>
The project reference adds only the assembly to ReferenceCopyLocalPaths,
so the standalone package took the .xml from next to it. No .xml
reaches the files packed as a tool, so that filter needs no exclusion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: CodeAlta <noreply@codealta.io>
@kzu
kzu merged commit 1d58191 into main Nov 29, 2026
6 checks passed
@kzu
kzu deleted the feat/compiledproxy-package branch November 29, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant