Closed JeremyAnsel closed 10 months ago
I suggest to include a source generator to generate the attributes.
I am familiar with source generators. I'm not really inclined to do that though. The biggest reason is source generators should be used to respond specifically to user edits, not just inject basic types. A source generator seems like a rather big hammer for something as small as adding a few types.
Looks like there might be a more light weight approach to this using the incremental source generators - RegisterPostInitializationOutput
. I'll try to get to this as it might be helpful for others.
@JeremyAnsel Thanks to @Sergio0694, a source generator now exists in https://www.nuget.org/packages/DNNE/2.0.6
Funny thing - already did this with my fork too 🤣🤣
Hello, I have an idea.
To use the
DNNE.ExportAttribute
,DNNE.C99TypeAttribute
, orDNNE.C99DeclCodeAttribute
attribute, you have to manually add them to your project as shown intest/ExportingAssembly/Dnne.Attributes.cs
. Instead of manually add them, I suggest to include a source generator to generate the attributes.Something like that:
.csproj
class library project:AttributesGenerator.cs
file:You can reference the project with:
The documentation to add the source generator to a NuGet package is here: Package a generator as a NuGet package