How to obtain the CSharp language version in the Register Post Initialization Output method of IIncreatingGenerator.
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
I am using the Register Post Initialization Output of I Creator Generator and want to add attributes that can guide source generation. At the same time, I need generic attributes, but this requires support from C # 11. Therefore, I need to determine the current language version and decide whether to add generic attributes.
In general generation, I can obtain language versions, such as:
```
context.RegisterSourceOutput(
context.ParseOptionsProvider,
(spc, parseOptions) =>
{
var languageVersion = parseOptions.LanguageVersion;
}
);
```
But in the Register Post Initialization Output, it seems to be not working. What should I do?
Contributor guide
Assessment
This issue has not been assessed yet.