Skip to content

Conversation

@j-d-ha
Copy link
Collaborator

@j-d-ha j-d-ha commented Dec 20, 2025

Summary

Fixes critical packaging issue where the source generator DLL was not being included in the NuGet package, causing the generator to not run when consumed from NuGet.org.

Changes

Fixed Generator Packaging

  • Changed from @(IntermediateAssembly) to $(OutputPath)\$(AssemblyName).dll in the pack configuration
  • The @(IntermediateAssembly) approach doesn't work reliably during the pack phase
  • Now the generator DLL is correctly placed in analyzers/dotnet/cs/ folder in the NuGet package

Impact

  • Before: Package contained only metadata (icon, README, .nuspec) - generator didn't run
  • After: Package contains the generator DLL in the correct location - generator executes and emits source files

Checklist

  • The build passes
  • Tests have been added or updated (if applicable)
  • Documentation has been updated (if applicable)
  • Code follows project conventions
  • Changes have been tested locally

Related Issues/PRs

Related to PR #7 - this fixes the packaging configuration that was added in that PR.

Reviewer Notes

Verification Steps:

  1. Run task pack to build the NuGet package
  2. Check package contents: unzip -l ./nupkg/LayeredCraft.SourceGeneratorTools.Generator.0.1.0-alpha.nupkg
  3. Verify analyzers/dotnet/cs/LayeredCraft.SourceGeneratorTools.Generator.dll exists in the package (37KB)
  4. Test by publishing and consuming from another project

Root Cause:
The @(IntermediateAssembly) MSBuild item doesn't resolve properly during the pack phase, resulting in an empty <None> include that silently fails.

Fix:
Using $(OutputPath)\$(AssemblyName).dll directly references the built DLL from the output directory, which works correctly during pack.

- Replace `@(IntermediateAssembly)` with `$(OutputPath)\$(AssemblyName).dll` for reliability
- Ensure proper packing of the generator DLL in the analyzers folder
@j-d-ha j-d-ha merged commit a4f14a6 into main Dec 20, 2025
1 check passed
@j-d-ha j-d-ha deleted the fix/update-pack branch December 20, 2025 20:44
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.

2 participants