-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source Generators: Allow embedding of files other than source #49935
Comments
Could I ask to add a possibility to include a non-compilable additional files? I need to send some metadata from SG to my VSIX (and update custom codelenses with that metadata), so I need to access that metadata (for example XML file) in |
This would be great. Source generators should be able to add other types of files to the output. One example would be Swagger that could generate the OpenAPI file at compile time and add the resulting .json to the compile output. Unless there is another way that could be done? |
Would be very useful! |
Any updates on this? |
Concrete use-case from my company: |
Our use case: |
I think this is a great idea! Generating C# source code is fantastic, but being able to generate other file types, such as I understand that As well as that, we could perhaps give flags to Personally, if I can use generators to create Thanks, and much respect to the dev team (who I imagine are already considering such ideas)! 😄 P.S. As a fellow developer, I understand that requests and ideas are often far beyond the current concerns and/or reach of development goals. I'm just here as a voice in favour of supporting generating different file types because it's incredibly useful and... it's awesome! |
I'd love to see this available from source generators. Two use cases come to mind:
Both of these are possible through secondary build actions which analyze the produced dll, but source generators are much easier. |
this feature would help me as well. I'm using source generators to generate a virtual lookup table, but I would also love to generate some static resource file about that metadata that downstream consumers could read without having to load up the |
We've seen from several customers the want to embed other files into the output assembly, particularly EmbeddedResources (see #49923)
We should explore an API that allows generators to add 'other' inputs to the compilation other than just source. This could be scoped explicitly to EmbeddedResources, or we might want to allow e.g. AdditionalFiles too.
Expanding it out to more types might have implications for analyzers, as they would be able to see them as well, but given that analyzers today see the generated source this seems desirable (although we might need an API that returns the provenance of the thing, such as Generated or Not).
The text was updated successfully, but these errors were encountered: