-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
For a library to include analyzers in its package, AnalyzerReference items must be defined. In contrast to that, for a library to consume an analyzer, a ProjectReference item with some metadata needs to be defined.
The Regex source generator is currently enabled in projects by setting a property which then just enables the ProjectReference with the metadata in the generators.targets file. We could avoid this indirection by supporting an AnalyzerReference item to also consume an analyzer and not just package it.
I think a good default behavior for the AnalyzerReference item would be:
<ProjectReference Include="..."
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />and by explicitly setting the Pack metadata on the AnalyzerReference item (<AnalyzerReference Include="..." Pack="true" />) it would be added to the package.
@ericstj what do you think about this?
cc @joperezr and @eerhardt for opinions