Skip to content

When can we use latest .NET runtime for source generator? #49320

Answered by chsienki
acaly asked this question in Q&A
Discussion options

You must be logged in to vote

@acaly The generator project needs to target netstandard2.0 if you plan to run it inside Visual Studio (VS is built on .NET Framework). You can certainly use multi-targeting of the dependent projects if you need to reference them from your generator to achieve that.

Note that multi-targeting will require your projects to be built multiple times for each target, which may slow your build times. Consider also extracting only the core pieces the generator relies on into a separate netstandard assembly that both the generator and your netcore targeting projects can reference.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@acaly
Comment options

Answer selected by acaly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants