// 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.Collections.Generic; using System.Reflection; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.Razor.Compilation; using Microsoft.CodeAnalysis; namespace ControllersFromServicesWebSite { #pragma warning disable CS0618 // Type or member is obsolete public class AssemblyMetadataReferenceFeatureProvider : IApplicationFeatureProvider { public void PopulateFeature(IEnumerable parts, MetadataReferenceFeature feature) { var currentAssembly = GetType().GetTypeInfo().Assembly; feature.MetadataReferences.Add(MetadataReference.CreateFromFile(currentAssembly.Location)); } } #pragma warning restore CS0618 // Type or member is obsolete }