varbuilder=newContainerBuilder();builder.RegisterSource(newResolveAnythingSource());varcontainer=builder.Build();// Works nowvarfoo=container.Resolve<Foo>();

One Small Caveat

You should probably be aware of one small gotcha that both of these samples exhibit. If you actually do register an implementation of Foo, then resolve all instances of Foo, you’ll find that both your registered component, plus the automatically-generated one, will be there. This is a very unlikely situation, but it might pay to keep it in mind.

If you found your way here looking for Autofac’s Prism integration, good news is right around the corner! The source for AutofacContrib.Prism is in the trunk, and just needs a few updates before it will get a proper release.