According to dependency inversion principle higher level module does not depend on lower level module rather they depend on abstraction. So it is a top down approach. I have a web project that has three tier. Tier 1 contain the view pages and controllers and viewmodels. Tier 2 is the Service layer and Tier 3 is repository. As the Web project is the most higher level module, it contains the interface that should be implemented by Service layer and Service layer contains the interface that should be implemented by repository. So Service layer has the reference of web project and repository has the reference of service layer. I am using autofac as IOC Container. As Service layer implement the interfaces of web project, I need to register interfaces to classes in Service layer in autofac module and also need to register the interfaces of service layer in repository layer in autofac module. As far as I know, I need to register the autofac module when the application starts. If I want to do so, I need to give the reference of service layer to web project and reference of repository layer to either in service layer or web project. But it will create circular build dependency if I want to follow the top down approach of DIP. My Question is How can I register the modules of autofac and maintain DIP?
Edit 1: Title of the question changes as I believe it would be a same approach for any DI Container
Dependency Inversion refers to the inversion of a dependency in a graph of dependencies .. it doesn't mean inverting the dependencies between assemblies (or inverting where objects live).
Your service layer interfaces should still reside in your service layer assembly or in another assembly somewhere else - not in your UI. However, your dependencies between the UI layer and the Service layer should be inverted.
Here is what a normal dependency looks like (arrow points down and the UI depends on a concrete object):
Here is what Dependency Inversion looks like (an arrow is inverted and the UI depends on the abstraction instead):
Notice that this has no concept of where things should be .. but hopefully it simplifies your understanding of the concept.