Part 4 of a series on incremental source generators covers the critical packaging details that cause generators to silently fail in consumer projects. Key topics include: targeting netstandard2.0 (the only TFM loadable by all Roslyn hosts), placing the generator DLL under analyzers/dotnet/cs/ instead of lib/, bundling zero external dependencies to avoid load-context conflicts, delivering marker attributes via RegisterPostInitializationOutput with [Conditional] and internal visibility, and verifying the shipped package by consuming the actual .nupkg locally before release. Also covers RS1035 (banned APIs) and RS2008 (diagnostic release tracking) analyzer rules, plus the IsRoslynComponent debug profile for stepping through generator code in Visual Studio.

12m read timeFrom daily-devops.net
Post cover image
Table of contents
netstandard2.0 Is Non-NegotiableThe Package Layout: analyzers/dotnet/cs or NothingDependencies Are Your Problem, Not NuGet’sDelivering the Marker AttributeDebugging the Shipped ExperienceAnalyzer Hygiene for ShippersThe Series, Closed
5.4K Impressions