Source Generators In Nuget Packages
I’m working on a source generator and initially thought it wasn’t working. I was adding it to another project via a private nuget package. I ended up including a direct project reference and walla, the generator started kicking in and shows up in the analyzers.
I cracked open the Nuget package and noticed there was no lib folder.
So what’s the correct way to publish a nuget package for a source generator project? And what’s the correct way to include said nuget into another project.
4 Replies
Generator Project
Project Including Nuget
GitHub
roslyn/docs/features/source-generators.cookbook.md at main · dotnet...
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs. - dotnet/roslyn
Also fyi that #roslyn exists and it's the better place to ask questions about source generators
Thanks. I did just get this working and will share my solution.
Adding the Include DLL => /analyzers path did the trick. Also means nothing special has to happen when the package is pulled into another project.