© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•16mo ago•
2 replies
CaptainToTo

✅ Include Source Generator With Library

I created a source generator for a framework I'm making. I'm trying to make the include tree look like this:
Generator -> Framework -> Application
                 ^            ^
              Generator applied to
          both framework & application
Generator -> Framework -> Application
                 ^            ^
              Generator applied to
          both framework & application


I'm including each like this:
application csproj:
  <ProjectReference Include="../Framework/Framework.csproj" />
application csproj:
  <ProjectReference Include="../Framework/Framework.csproj" />

framework csproj:
  <ProjectReference Include="../Generator/Generator.csproj" OutputItemType="analyzer" ReferenceOutputAssembly="false" />
framework csproj:
  <ProjectReference Include="../Generator/Generator.csproj" OutputItemType="analyzer" ReferenceOutputAssembly="false" />

generator csproj:
  <None Include="$(OutputPath)/netver/$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
generator csproj:
  <None Include="$(OutputPath)/netver/$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />

rn the generator is only being applied to the framework. I've been looking all over to figure out how to get it to also apply to the application, but I can't find anything that works. Any suggestions would be super helpful.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Package Source Generator Library
C#CC# / help
3y ago
source generator
C#CC# / help
3y ago
Compilation issue with source generator
C#CC# / help
14mo ago
❔ Source generator & protobuf
C#CC# / help
4y ago