'DefaultAssembliesResolver in .net core?

I have changed the web api project from .NET framework to .NET 6, could you please guide how to change the DefaultAssembliesResolver in .NET 6? I know it's not supported, please suggest some alternative code. I'm badly stuck over here.

public class LocalAssembliesOnlyResolver : DefaultAssembliesResolver
    {
        public List<Type> Types { get; set; }

        public LocalAssembliesOnlyResolver()
        {
            Types = new List<Type>();
        }

        public override ICollection<Assembly> GetAssemblies()
        {
            var assemblyList = new List<Assembly>();
            //only look in these Assemblies for Controllers
            foreach (var type in Types)
                assemblyList.Add(type.Assembly);
            
            return assemblyList;
        }
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source