Why are “old versions” of the framework (e.g., System.Core 2.0.5.0) referenced?

Autofac (3.x) is a Portable Class Library that targets multiple platforms.

As a Portable Class Library, if you open up Autofac in Reflector, dotPeek, or other like tools, you’ll see references to version 2.0.5.0 of various system libraries. Version 2.0.5.0 is, in fact, the Silverlight version of the .NET framework. This is expected and is not a problem. At runtime everything pans out. Autofac will correctly bind to the framework version you’re using - be it .NET 4.5, Silverlight, or Windows Phone. You can read more about Portable Class Libraries on MSDN.

You may encounter an exception that looks something like this when using Autofac as a Portable Class Library:

Test 'MyNamespace.MyFixture.MyTest' failed: System.IO.FileLoadException : Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
    at Autofac.Builder.RegistrationData..ctor(Service defaultService)
    at Autofac.Builder.RegistrationBuilder`3..ctor(Service defaultService, TActivatorData activatorData, TRegistrationStyle style)
    at Autofac.RegistrationExtensions.RegisterInstance[T](ContainerBuilder builder, T instance)
    MyProject\MyFixture.cs(49,0): at MyNamespace.MyFixture.MyTest()

Make sure your .NET framework is patched. Microsoft released patches to .NET to allow Portable Class Libraries to properly find the appropriate runtime (KB2468871). If you are seeing the above exception (or something like it), it means you’re missing the latest .NET framework patches.

This blog entry has a good overview of these and other things you might see when you use Portable Class Libraries.

Autofac 4.x moved away from Portable Class Libraries and targets .NET Standard instead. You shouldn’t see these errors with Autofac 4.x or higher.