Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autofac has downloaded and I have access to the builder methods but not the RegisterControllers method

Tags:

c#

autofac

My code below is what I have so far. The RegisterControllers method does not exist although I can see it on the autofac documentation as well other stack overflow questions. Visual studio keeps saying "ContainerBuilder does not contain a definition for RegisterControllers"

 var builder = new ContainerBuilder();
            builder.RegisterControllers(typeof(MvcApplication).Assembly);
            builder.RegisterType<FakeBrandVMData>().As<IBrandVMData>();
            Container = builder.Build();
like image 255
Jack Tyler Avatar asked Oct 27 '25 06:10

Jack Tyler


1 Answers

I've figured it out. I needed to add another package and reference. The Package was "AutoFac.Mvc5" and the reference was "AutoFac.Integration.Mvc". Once they were added the error went away.

like image 61
Jack Tyler Avatar answered Oct 28 '25 21:10

Jack Tyler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!