Source Generator AdditionalFiles Batching missing metadata
Hey folks,
I am working with a source generator that wraps NSwag to generate clients and servers based on OpenApi spesefications. I have each project that wants to have generated client add the following Item.
I have both of these custom items defined with the following
I then merge these two items into an
AdditionalFiles
item so that it could be read by the source generator.
If I were evaluate this the following would be returned, as expected dotnet msbuild -getItem:AdditionalFiles
When trying to access this from the source generator only the first two elements are returned from AdditionalTextsProvider
.3 Replies
I would expect either all three to be returned or the second two items would have their metadata merged. In this case it just completely drops the second one since it's got the same identity.
My backup option which is really ugly is to just give it a unique identity to make it unique, but that is very ugly. I was just trying to figure out if this is expected. If I was writing a custom ITask I would have access to all elements.
my ugly workaround
Try #roslyn, you'll get much better help for this there.
I will try out it, thank you 🙂