Skip to content

Allow us to detect in which context a source generator is running #64173

Closed Answered by kzu
xoofx asked this question in Ideas
Discussion options

You must be logged in to vote

I indeed use the $(DesignTimeBuild) property for exactly this purpose and it works great. It's set as a global property by VS when it runs the design-time build (you can see this by using the Project System Tools extension in VS and the msbuildlog.com tool). You just make it a CompilerVisibleProperty and check it from the generator. I'm not sure Rider does the same though.

Replies: 3 comments 18 replies

Comment options

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

Comment options

You must be logged in to vote
11 replies
@jasonmalinowski
Comment options

@xoofx
Comment options

@ltrzesniewski
Comment options

@Sergio0694
Comment options

@jasonmalinowski
Comment options

Comment options

You must be logged in to vote
6 replies
@xoofx
Comment options

@CyrusNajmabadi
Comment options

@xoofx
Comment options

@kzu
Comment options

Answer selected by xoofx
@xoofx
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
9 participants