diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ApplicationParts/RazorCompiledItemFeatureProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ApplicationParts/RazorCompiledItemFeatureProvider.cs
index ccfc49127d..eece1503ab 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ApplicationParts/RazorCompiledItemFeatureProvider.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/ApplicationParts/RazorCompiledItemFeatureProvider.cs
@@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
foreach (var item in provider.CompiledItems)
{
- var descriptor = new CompiledViewDescriptor(item, attribute: null);
+ var descriptor = new CompiledViewDescriptor(item);
feature.ViewDescriptors.Add(descriptor);
}
}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs
deleted file mode 100644
index 911b010261..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/ViewsFeatureProvider.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using Microsoft.AspNetCore.Mvc.ApplicationParts;
-using Microsoft.Extensions.Primitives;
-
-namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
-{
- ///
- /// An for .
- ///
- [Obsolete("This type is obsolete and will be removed in a future version. See " + nameof(IRazorCompiledItemProvider) + " for alternatives.")]
- public class ViewsFeatureProvider : IApplicationFeatureProvider
- {
- public static readonly string PrecompiledViewsAssemblySuffix = ".PrecompiledViews";
-
- ///
- public void PopulateFeature(IEnumerable parts, ViewsFeature feature)
- {
- foreach (var assemblyPart in parts.OfType())
- {
- var viewAttributes = GetViewAttributes(assemblyPart)
- .Select(attribute => (Attribute: attribute, RelativePath: ViewPath.NormalizePath(attribute.Path)));
-
- var duplicates = viewAttributes.GroupBy(a => a.RelativePath, StringComparer.OrdinalIgnoreCase)
- .FirstOrDefault(g => g.Count() > 1);
-
- if (duplicates != null)
- {
- // Ensure parts do not specify views with differing cases. This is not supported
- // at runtime and we should flag at as such for precompiled views.
- var viewsDifferingInCase = string.Join(Environment.NewLine, duplicates.Select(d => d.RelativePath));
-
- var message = string.Join(
- Environment.NewLine,
- Resources.RazorViewCompiler_ViewPathsDifferOnlyInCase,
- viewsDifferingInCase);
- throw new InvalidOperationException(message);
- }
-
- foreach (var (attribute, relativePath) in viewAttributes)
- {
- var viewDescriptor = new CompiledViewDescriptor
- {
- ExpirationTokens = Array.Empty(),
- RelativePath = relativePath,
- ViewAttribute = attribute,
- };
-
- feature.ViewDescriptors.Add(viewDescriptor);
- }
- }
- }
-
- ///
- /// Gets the sequence of instances associated with the specified .
- ///
- /// The .
- /// The sequence of instances.
- protected virtual IEnumerable GetViewAttributes(AssemblyPart assemblyPart)
- {
- if (assemblyPart == null)
- {
- throw new ArgumentNullException(nameof(assemblyPart));
- }
-
- var featureAssembly = GetFeatureAssembly(assemblyPart);
- if (featureAssembly != null)
- {
- return featureAssembly.GetCustomAttributes();
- }
-
- return Enumerable.Empty();
- }
-
- private static Assembly GetFeatureAssembly(AssemblyPart assemblyPart)
- {
- if (assemblyPart.Assembly.IsDynamic || string.IsNullOrEmpty((string)assemblyPart.Assembly.Location))
- {
- return null;
- }
-
- var precompiledAssemblyFileName = assemblyPart.Assembly.GetName().Name
- + PrecompiledViewsAssemblySuffix
- + ".dll";
-
- var precompiledAssemblyFilePath = Path.Combine(
- Path.GetDirectoryName(assemblyPart.Assembly.Location),
- precompiledAssemblyFileName);
-
- if (File.Exists(precompiledAssemblyFilePath))
- {
- try
- {
- return Assembly.LoadFile(precompiledAssemblyFilePath);
- }
- catch (FileLoadException)
- {
- // Don't throw if assembly cannot be loaded. This can happen if the file is not a managed assembly.
- }
- }
-
- return null;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
index 7b3ee93a3a..fdd018eca7 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
@@ -72,13 +72,6 @@ namespace Microsoft.Extensions.DependencyInjection
{
builder.PartManager.FeatureProviders.Add(new RazorCompiledItemFeatureProvider());
}
-
-#pragma warning disable CS0618 // Type or member is obsolete
- if (!builder.PartManager.FeatureProviders.OfType().Any())
- {
- builder.PartManager.FeatureProviders.Add(new ViewsFeatureProvider());
- }
-#pragma warning restore CS0618 // Type or member is obsolete
}
///
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
index dbe98e5fad..b58349c3db 100644
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
+++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs
@@ -114,11 +114,6 @@ namespace Microsoft.Extensions.DependencyInjection
services.TryAddSingleton();
services.TryAddSingleton();
- // Page model binding
-#pragma warning disable CS0618 // Type or member is obsolete
- services.TryAddSingleton();
-#pragma warning restore CS0618 // Type or member is obsolete
-
// Action executors
services.TryAddSingleton();
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageArgumentBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageArgumentBinder.cs
deleted file mode 100644
index acc6b2f001..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/DefaultPageArgumentBinder.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Abstractions;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-{
-#pragma warning disable CS0618 // Type or member is obsolete
- internal class DefaultPageArgumentBinder : PageArgumentBinder
-#pragma warning restore CS0618 // Type or member is obsolete
- {
- private readonly ParameterBinder _parameterBinder;
-
- public DefaultPageArgumentBinder(ParameterBinder binder)
- {
- _parameterBinder = binder;
- }
-
- protected override async Task BindAsync(PageContext pageContext, object value, string name, Type type)
- {
- var valueProvider = await GetCompositeValueProvider(pageContext);
- var parameterDescriptor = new ParameterDescriptor
- {
- BindingInfo = null,
- Name = name,
- ParameterType = type,
- };
-
-#pragma warning disable CS0618 // Type or member is obsolete
- return await _parameterBinder.BindModelAsync(pageContext, valueProvider, parameterDescriptor, value);
-#pragma warning restore CS0618 // Type or member is obsolete
- }
-
- private static async Task GetCompositeValueProvider(PageContext pageContext)
- {
- var factories = pageContext.ValueProviderFactories;
- var valueProviderFactoryContext = new ValueProviderFactoryContext(pageContext);
- for (var i = 0; i < factories.Count; i++)
- {
- var factory = factories[i];
- await factory.CreateValueProviderAsync(valueProviderFactoryContext);
- }
-
- return new CompositeValueProvider(valueProviderFactoryContext.ValueProviders);
- }
- }
-}
diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageArgumentBinder.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageArgumentBinder.cs
deleted file mode 100644
index a4d8f5cba6..0000000000
--- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageArgumentBinder.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.ModelBinding;
-
-namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
-{
- [Obsolete("This type is obsolete and will be removed in a future version.")]
- public abstract class PageArgumentBinder
- {
- public async Task