How do I resolve Autofac.Configuration Exception?

Nov 17, 2010 at 3:03 AM

I have  2 instances of .8,xxx release of Orchard, one on Windows 7 and the other on WinXp.  Everything has been working fine but after I enabled some modules and used the command line tool to  create child themes, and the REBUILD the sites, I am now getting  this exception: 

Could not load file or assembly 'Autofac.Configuration, Version=, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The system cannot find the file specified.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Autofac.Configuration, Version=, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 26:             RegisterRoutes(RouteTable.Routes);
Line 27: 
Line 28:             _host = OrchardStarter.CreateHost(MvcSingletons);
Line 29:             _host.Initialize();
Line 30:         }

Source File: C:\Users\cbian\Documents\My Web Sites\OrchardNov\Orchard\Global.asax.cs    Line: 28

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Autofac.Configuration, Version=, Culture=neutral, PublicKeyToken=17863af14b0044da' could not be loaded.

Dec 29, 2010 at 7:21 AM

having the exact same issue... any resolution?

Jan 16, 2011 at 5:51 PM

I'm having this problem, too.

Jan 17, 2011 at 12:35 AM

Note sure what's going on there. The assembly "Autofac.Configuration.dll" is supposed to be in the "~/bin" folder. Is it located there? Is it the right version ( Same questions for the "Autofac.dll" assembly (which is the only non-framework dependency)...

Jan 17, 2011 at 7:45 PM
Edited Jan 17, 2011 at 7:46 PM

May have been caused by making the mistake of adding the generated project files to the Orchard project within Solution Explorer then undoing (removing) this when the project stopped building due to duplicate AssemblyInfo.cs bits. Other than this, I don't know what caused this. Autofac DLLs are in the bin dir, btw.

Jan 17, 2011 at 11:41 PM

Are the autofac DLLS in "~/bin" the right version number? (You can use Reflector or ildasm to check). Also, is this using 0.8 or 1.0? I think we had an issue in 0.8 where some of our project files where refering to an older version of Autofac...

Jan 18, 2011 at 1:56 AM
Edited Jan 18, 2011 at 1:57 AM

Not for me. I was using v1 from the beginning for our current project. Autofac.Configuration.dll may have disappeared .. unfortunately I'm not at the machine I found this problem on at the moment.

Jan 19, 2011 at 8:20 PM

For what is is worth - having the same issue as well.

Jan 20, 2011 at 2:15 AM

If you still have this problem on a machine, would you mind taking a look at the content of the "~/bin" folder and check for the Autofac.Configuration.dll file?

Jan 29, 2011 at 2:40 AM

I had the same problem, it seems like when you build Orchard (not the source version) it deletes the Autofac dlls and some other dlls.  Just recopy the dlls to the bin folder if you have a copy somewhere or redownload. 

Jan 29, 2011 at 3:34 PM

Same here - I tried uploading my project onto my hosting provider to test out Orchard and it complained about missing Autofac and about 10 other dlls after that.

I resolved by extracting the original zip into another directory and uploading each missing dll.

Apr 6, 2011 at 10:10 AM

I've had the exact same problem - if, in visual studio, you run a rebuild of Orchard.Web (not the source version) or do a clean, then the following files are removed from the /bin directory (dump from hg stat after a rebuild);

! trunk\bin\Antlr3.Runtime.dll
! trunk\bin\Autofac.Configuration.dll
! trunk\bin\Castle.Core.dll
! trunk\bin\Castle.DynamicProxy2.dll
! trunk\bin\Castle.Services.Logging.Log4netIntegration.dll
! trunk\bin\ClaySharp.dll
! trunk\bin\FluentNHibernate.dll
! trunk\bin\FluentNHibernate.pdb
! trunk\bin\Iesi.Collections.dll
! trunk\bin\NHibernate.Linq.dll
! trunk\bin\NHibernate.dll
! trunk\bin\Orchard.Core.pdb
! trunk\bin\Orchard.Framework.pdb
! trunk\bin\Orchard.pdb
! trunk\bin\log4net.dll

Re-adding the files is a doddle (I have a little batch file that hg reverts the removals), but it's a bit of a pain - just executing build doesn't appear to suffer the same behaviour.

Apr 18, 2011 at 8:42 PM
Edited Apr 18, 2011 at 8:48 PM

same error here... :( 

I got the orcharbuild from wpi installer, opened the project in visual studio and did a rebuild.

To publish I had to manually exclude quite a large number of stuff from within Modules directory.

I guess this isn't how Orchard is supposed to be deployed? I couldn't find any documentation on deploying from visual studio. 

May 22, 2011 at 4:19 PM

same here: wpi install of core site only.

followed the documentations instructions to install the code gen to make a child theme, and crash: it's dead.

I'm pretty sure I rebuilt along the way.

Anyway, copying the following files into the /bin seemed to fix it: