Skip to content

Instantly share code, notes, and snippets.

@GeorgDangl
Created July 10, 2018 12:05
Show Gist options
  • Save GeorgDangl/6ba8339308857d6d04eb11c8880247c6 to your computer and use it in GitHub Desktop.
Save GeorgDangl/6ba8339308857d6d04eb11c8880247c6 to your computer and use it in GitHub Desktop.
Excluding Assemblies from ASP.NET Core MVC Controller Discovery
services.AddMvc()
// This allows to exclude some assembly from controller discovery
.ConfigureApplicationPartManager(a =>
{
var appPart = a.ApplicationParts.FirstOrDefault(ap => ap.Name == "Assembly.Name");
if (appPart != null)
{
a.ApplicationParts.Remove(appPart);
}
})
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment