Ask Your Question
4

Is it possible to use C# source generators (specifically IIncrementalGenerator) to generate code in a separate project?

asked 2023-02-05 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-07-14 02:00:00 +0000

devzero gravatar image

Yes, it is possible to use C# source generators to generate code in a separate project. You can create a class library project that contains the source generator and reference it from the project where you want to generate code. You can then specify the output directory for the generated code using the AdditionalFiles parameter in the GeneratorDriver.Create method. This allows you to generate code in a separate project and use it in your application.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-02-05 11:00:00 +0000

Seen: 9 times

Last updated: Jul 14 '21