diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs index 30f806645b6b..986d7873a357 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToUseAnalyzers.cs @@ -28,7 +28,7 @@ public void It_resolves_requestdelegategenerator_correctly(string testAssetName, }); VerifyRequestDelegateGeneratorIsUsed(asset, isEnabled); - VerifyInterceptorsFeatureEnabled(asset, isEnabled); + VerifyInterceptorsFeatureProperties(asset, isEnabled, "Microsoft.AspNetCore.Http.Generated"); } [Theory] @@ -50,7 +50,7 @@ public void It_resolves_configbindinggenerator_correctly(string testAssetName, b }); VerifyConfigBindingGeneratorIsUsed(asset, isEnabled); - VerifyInterceptorsFeatureEnabled(asset, isEnabled); + VerifyInterceptorsFeatureProperties(asset, isEnabled, "Microsoft.Extensions.Configuration.Binder.SourceGeneration"); } [Fact] @@ -67,7 +67,7 @@ public void It_enables_requestdelegategenerator_and_configbindinggenerator_for_P VerifyRequestDelegateGeneratorIsUsed(asset, expectEnabled: true); VerifyConfigBindingGeneratorIsUsed(asset, expectEnabled: true); - VerifyInterceptorsFeatureEnabled(asset, expectEnabled: true); + VerifyInterceptorsFeatureProperties(asset, expectEnabled: true, "Microsoft.AspNetCore.Http.Generated", "Microsoft.Extensions.Configuration.Binder.SourceGeneration"); } [Fact] @@ -84,7 +84,7 @@ public void It_enables_requestdelegategenerator_and_configbindinggenerator_for_P VerifyRequestDelegateGeneratorIsUsed(asset, expectEnabled: true); VerifyConfigBindingGeneratorIsUsed(asset, expectEnabled: true); - VerifyInterceptorsFeatureEnabled(asset, expectEnabled: true); + VerifyInterceptorsFeatureProperties(asset, expectEnabled: true, "Microsoft.AspNetCore.Http.Generated", "Microsoft.Extensions.Configuration.Binder.SourceGeneration"); } private void VerifyGeneratorIsUsed(TestAsset asset, bool? expectEnabled, string generatorName) @@ -112,13 +112,13 @@ private void VerifyRequestDelegateGeneratorIsUsed(TestAsset asset, bool? expectE private void VerifyConfigBindingGeneratorIsUsed(TestAsset asset, bool? expectEnabled) => VerifyGeneratorIsUsed(asset, expectEnabled, "Microsoft.Extensions.Configuration.Binder.SourceGeneration.dll"); - private void VerifyInterceptorsFeatureEnabled(TestAsset asset, bool? expectEnabled) + private void VerifyInterceptorsFeatureProperties(TestAsset asset, bool? expectEnabled, params string[] expectedNamespaces) { var command = new GetValuesCommand( Log, asset.Path, ToolsetInfo.CurrentTargetFramework, - "Features", + "InterceptorsPreviewNamespaces", GetValuesCommand.ValueType.Property); command @@ -126,9 +126,9 @@ private void VerifyInterceptorsFeatureEnabled(TestAsset asset, bool? expectEnabl .Execute() .Should().Pass(); - var features = command.GetValues(); + var namespaces = command.GetValues(); - Assert.Equal(expectEnabled ?? false, features.Any(feature => feature.Contains("InterceptorsPreview"))); + Assert.Equal(expectEnabled ?? false, expectedNamespaces.All(expectedNamespace => namespaces.Contains(expectedNamespace))); } [Theory] diff --git a/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets b/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets index dc9cffe58d30..9676aac013cd 100644 --- a/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets +++ b/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets @@ -59,9 +59,11 @@ Copyright (c) .NET Foundation. All rights reserved. true - - - $(Features);InterceptorsPreview + + + $(InterceptorsPreviewNamespaces);Microsoft.AspNetCore.Http.Generated + + $(InterceptorsPreviewNamespaces);Microsoft.Extensions.Configuration.Binder.SourceGeneration