-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 generator targets (from NuGet packages) not running on unsupported TFMs #84570
Comments
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsThe PR 9eab1ce fixes this issue for the config binding generator, enforcing that the enabling target runs for all TFMs & also emitting the compat warning for unsupported TFMs. This fix is hardcoded for now. We should also fix it for the other source-generator targets for multi-targeting and disabling, and come up with the right templating across all the targets & packages.
|
The way Microsoft.Extensions.Configuration.Binder checks target framework compatibility in #84379 does not look compatible with target framework aliases. So even if NuGet/Home#5154 is fixed at the NuGet side, aliases still would not work with this package, unless the consuming project sets the SuppressTfmSupportBuildWarnings property. I guess fixing that would mean changing Lines 19 to 26 in 5535e31
to <_Microsoft_Extensions_Configuration_Binder_Compatible_TargetFramework
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND
$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '2.0')) AND
!$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '6.0'))"
>net6.0</_Microsoft_Extensions_Configuration_Binder_Compatible_TargetFramework>
<_Microsoft_Extensions_Configuration_Binder_Compatible_TargetFramework
Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' AND
$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '4.6.1')) AND
!$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '4.6.2'))"
>net462</_Microsoft_Extensions_Configuration_Binder_Compatible_TargetFramework> Fortunately, |
The
AddNETStandardCompatErrorFileForPackaging
target infra to emit a warning for unsupported NuGet package consuming TFMs causes source generator targets (for Roslyn version multitargeting, and for enabling/disabling generators) to get dropped for unsupported TFMs. This is undesirable and can lead to undefined behavior.PR 9eab1ce fixes this issue for the config binding generator, enforcing that the enabling target runs for all TFMs & also emitting the compat warning for unsupported TFMs. This fix is hardcoded for now. We should also fix it for the other source-generator targets for multi-targeting and disabling, and come up with the right templating across all the targets & packages.
cc @ViktorHofer @ericstj
The text was updated successfully, but these errors were encountered: