Skip to content

Depend on the source generator package instead of bundling it - #79

Merged
windischb merged 1 commit into
developfrom
claude/signalarr-packaging-error-f9427f
Sep 25, 2026
Merged

windischb merged 1 commit into
developfrom
claude/signalarr-packaging-error-f9427f

Conversation

@windischb

@windischb windischb commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Cocoar.SignalARRR.Client and Cocoar.SignalARRR.Server each bundled a copy of Cocoar.SignalARRR.SourceGenerator.dll under analyzers/dotnet/cs. A project that references both (typically an ASP.NET integration test project) ran the generator twice. Every proxy was generated twice and the build failed with CS0101/CS0111.

Fix

  • Client and Server no longer bundle the DLL. Both depend on the existing Cocoar.SignalARRR.SourceGenerator package, which is already published with every release. NuGet resolves that package once, so only one generator runs.
  • NuGet leaves a ProjectReference with ReferenceOutputAssembly="false" out of the package dependencies, so the generator is now referenced as an assembly:
    • Private="false" keeps it out of the build output and the package.
    • PrivateAssets="compile;runtime" lets the analyzer flow to consumers without passing on a compile reference, including to the projects in this repo that reference Client or Server.
  • MSB3277 (Roslyn's System.Collections.Immutable vs net8.0's) is silenced in Client and Server only. Consumers never resolve the generator as an assembly, so they don't see it.
  • Behaviour is unchanged otherwise:
    • Contract projects that reference only Contracts get no generator, as before.
    • The generator code itself is untouched.
  • Docs no longer describe the generator as part of Contracts, which hasn't been true since 4.2.1. Skill regenerated, CHANGELOG entry under Unreleased.

Verification

  • Solution build: 0 warnings, 0 errors
  • Unit tests: 275/275 passed on net8.0, net9.0 and net10.0
  • Integration tests: 153/153 passed on net10.0
  • Packed the repo state and tested against a local feed:
    • The Client and Server nuspecs depend on Cocoar.SignalARRR.SourceGenerator (include="…Analyzers…") and contain no DLL copy.
    • An app with Client + Server (net10.0 and net8.0) builds with 0 warnings, the generator is resolved once, and each proxy is generated once.
    • An app with only Client, and an app with only Server, both build and generate their proxies.
    • A contract library referencing only Contracts contains no generated code.

🤖 Generated with Claude Code

Client and Server each carried a copy of Cocoar.SignalARRR.SourceGenerator.dll
under analyzers/dotnet/cs. A project referencing both ran the generator twice,
generated every proxy twice and failed with duplicate type errors.

Both now depend on the Cocoar.SignalARRR.SourceGenerator package, which NuGet
resolves once. NuGet drops ProjectReferences with ReferenceOutputAssembly=false
from a package's dependencies, so the generator is referenced as an assembly
with Private=false (kept out of output and package) and
PrivateAssets=compile;runtime (analyzer flows, compile reference does not).
MSB3277 from the generator's Roslyn dependencies is silenced in these two
projects only; consumers never resolve the generator as an assembly.

Docs no longer describe the generator as part of Contracts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@windischb
windischb force-pushed the claude/signalarr-packaging-error-f9427f branch from 78e22d2 to fa0a750 Compare September 25, 2026 11:35
@windischb windischb changed the title Ship the source generator only in Contracts Depend on the source generator package instead of bundling it Sep 25, 2026
@windischb
windischb merged commit be6b13d into develop Sep 25, 2026
13 checks passed
@windischb
windischb deleted the claude/signalarr-packaging-error-f9427f branch September 26, 2026 09:51
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