[release/8.0] Enable interceptors implicitly in binder gen nupkg when generator is...
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Wed, 6 Sep 2023 19:52:57 +0000 (12:52 -0700)
committerGitHub <noreply@github.com>
Wed, 6 Sep 2023 19:52:57 +0000 (12:52 -0700)
* Enable interceptors implicitly in binder gen nupkg when generator is enabled

* Simplify impl & remove unneeded target

---------

Co-authored-by: Layomi Akinrinade <laakinri@microsoft.com>
src/libraries/Microsoft.Extensions.Configuration.Binder/src/buildTransitive/Microsoft.Extensions.Configuration.Binder.targets

index f091c7a..fdfd48d 100644 (file)
@@ -1,5 +1,10 @@
 <Project InitialTargets="NETStandardCompatError_Microsoft_Extensions_Configuration_Binder">
-    <Target Name="_Microsoft_Extensions_Configuration_BinderRemoveAnalyzer" 
+    <PropertyGroup Condition="'$(EnableConfigurationBindingGenerator)' == 'true'">
+        <!-- The configuration binding source generator uses a preview version of the compiler interceptors feature. Enable it implicitly when the generator is enabled. -->
+        <InterceptorsPreviewNamespaces>$(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration</InterceptorsPreviewNamespaces>
+    </PropertyGroup>
+
+    <Target Name="_Microsoft_Extensions_Configuration_Binder_RemoveAnalyzer"
             Condition="'$(EnableConfigurationBindingGenerator)' != 'true'"
             AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets">
 
@@ -8,8 +13,8 @@
         </ItemGroup>
     </Target>
 
-     <Target Name="NETStandardCompatError_Microsoft_Extensions_Configuration_Binder"
-          Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
+    <Target Name="NETStandardCompatError_Microsoft_Extensions_Configuration_Binder"
+            Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
         <PropertyGroup>
             <_Microsoft_Extensions_Configuration_Binder_Compatible_TargetFramework
                 Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp2.0')) AND