Donate

Castle.MicroKernel.Registration.AllTypes' is obsolete in ASP.NET MVC 5

In the event that you'll be referencing Castle Windsor 3.3.0 and incorporate the IOC container in your project, you will encounter the error stated by the title of this post. This happens when you use register the controllers to the IOC container using AllTypes class.

1
2
3
4
container.Register(AllTypes.FromThisAssembly()
      .Pick().If(t => t.Name.EndsWith("Controller"))
      .Configure(configurer => configurer.Named(configurer.Implementation.Name))
      .LifestylePerWebRequest());

This class has been deprecated in the recent versions of Castle Windsor. The solution is to update the Register method and replace AllTypes with Castle.MicroKernel.Registration.Classes.

1
2
3
4
container.Register(Classes.FromThisAssembly()
     .Pick().If(t=> t.Name.EndsWith("Controller"))
     .Configure(configurer => configurer.Named(configurer.Implementation.Name))
     .LifestylePerWebRequest());

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.