var builder = new ContainerBuilder(); builder.RegisterAssemblyModules(typeof(MyModule).Assembly); var container = builder.Build();
var builder = new ContainerBuilder(); builder.RegisterAssemblyModules(Assembly.GetExecutingAssembly()); var container = builder.Build();In this example, we use Assembly.GetExecutingAssembly() to get the assembly that contains the code running at the moment. Package/Library: Autofac Autofac is a third-party open-source library/package used for Dependency Injection (DI) container. It is an alternative to Microsoft's built-in DI container. Autofac offers many advanced features and extensions to the built-in DI container.