Hangfire.Autofac with Autofac 4.0.0-beta*

I’m using the following dependencies:

"Autofac": "4.0.0-beta5-90",
"Hangfire": "1.5.0-beta2",
"Hangfire.SqlServer": "1.5.0-beta2",
"Hangfire.Autofac": "1.2.0-beta1",

When I try to setup Autofac in my Startup.cs file:

GlobalConfiguration.Configuration.UseAutofacActivator(IContainer)

I get the follow error:

The type 'ILifetimeScope' is defined in an assembly that is not referenced. You must add a reference to assembly 'Autofac, Version=2.6.3.862, Culture=neutral, PublicKeyToken=17863af14b0044da'.

If I remove the package Hangfire.Autofac and copy the classes locally into my solution it works just fine.

Is Hangfire.Autofac not allowing the 4.0 beta version of Autofac? Using this is requirement for me as I’m using ASP.NET 5 beta for my project.

1 Like

Hi there,

I had the same issue. Seems to be fixed with the following;

"Autofac.Framework.DependencyInjection": "4.0.0-beta8",
"Hangfire": "1.5.1",
"Hangfire.Autofac": "2.0.1",
1 Like