From e039add584070f5ae15a17326e183d9190d61cdb Mon Sep 17 00:00:00 2001 From: Layomi Akinrinade Date: Sun, 9 Apr 2023 10:34:15 -0700 Subject: [PATCH] Simplify target to enable config binding src generator from NuGet package, ensure it runs for all TFMs, and rename enabling property (#84379) * Simplify target to enable config binding src generator and rename sentinel property * Further simplify target * Address feedback * Ensure generator removal target is for all TFMs * Add logic to emit correct recommended minimum TFM --- ...fByDefaultRoslynComponent.targets.template | 17 --------- eng/packaging.targets | 35 ------------------- ...oft.Extensions.Configuration.Binder.csproj | 6 +++- ...ft.Extensions.Configuration.Binder.targets | 26 ++++++++++++++ 4 files changed, 31 insertions(+), 53 deletions(-) delete mode 100644 eng/OffByDefaultRoslynComponent.targets.template create mode 100644 src/libraries/Microsoft.Extensions.Configuration.Binder/src/buildTransitive/Microsoft.Extensions.Configuration.Binder.targets diff --git a/eng/OffByDefaultRoslynComponent.targets.template b/eng/OffByDefaultRoslynComponent.targets.template deleted file mode 100644 index 056fa1a376fa3..0000000000000 --- a/eng/OffByDefaultRoslynComponent.targets.template +++ /dev/null @@ -1,17 +0,0 @@ - - - - <_{TargetPrefix}Analyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == '{NuGetPackageId}'" /> - - - - - - - - - - diff --git a/eng/packaging.targets b/eng/packaging.targets index 264fc6828181f..5dbadba029db9 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -193,41 +193,6 @@ Overwrite="true" /> - - <_OffByDefaultRoslynComponentTargetsTemplate>$(MSBuildThisFileDirectory)OffByDefaultRoslynComponent.targets.template - $(IntermediateOutputPath)OffByDefaultRoslynComponent.targets - false - - - - - - - - - - - - - <_OffByDefaultRoslynComponentTargetPrefix>$(PackageId.Replace('.', '_')) - Enable$(PackageId.Replace('.', ''))SourceGenerator - - - - - false - true + true + + + + diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/src/buildTransitive/Microsoft.Extensions.Configuration.Binder.targets b/src/libraries/Microsoft.Extensions.Configuration.Binder/src/buildTransitive/Microsoft.Extensions.Configuration.Binder.targets new file mode 100644 index 0000000000000..f091c7a57b23a --- /dev/null +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/src/buildTransitive/Microsoft.Extensions.Configuration.Binder.targets @@ -0,0 +1,26 @@ + + + + + + + + + + + <_Microsoft_Extensions_Configuration_Binder_Compatible_TargetFramework + Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp2.0')) AND + !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))" + >net6.0 + <_Microsoft_Extensions_Configuration_Binder_Compatible_TargetFramework + Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net461')) AND + !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net462'))" + >net462 + + + +