I created a projected that used a new version of autofac installed via nuget
Install-Package Autofac -Pre
Everything was working fine until I deployed the project to a production. And then, I saw an error:
Unhandled Exception: 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 code
base was invalid. (Exception from HRESULT: 0x80131047)
at Autofac.Builder.RegistrationData..ctor(Service defaultService)
at Autofac.Builder.RegistrationBuilder`3..ctor(Service defaultService, TActiv
atorData activatorData, TRegistrationStyle style)
at Autofac.Builder.RegistrationBuilder.ForType[TImplementer]()
at Autofac.RegistrationExtensions.RegisterType[TImplementer](ContainerBuilder
builder)
at TTC.ContentHubDataCache.ContainerSetup.BuildContainer() in C:\Development\
BrandWebsites\TrafalgarTools\TTC.ContentHubDataCache\TTC.ContentHubDataCache\Con
tainerSetup.cs:line 26
at TTC.ContentHubDataCache.UpdateDataCacheProcess..ctor() in C:\Development\B
randWebsites\TrafalgarTools\TTC.ContentHubDataCache\TTC.ContentHubDataCache\Upda
teDataCacheProcess.cs:line 58
at TTC.ContentHubDataCache.Program.Main(String[] args) in C:\Development\Bran
dWebsites\TrafalgarTools\TTC.ContentHubDataCache\TTC.ContentHubDataCache\Program
.cs:line 9
It looked like autofac is referencing a System.Core in a really old version. A quick look at Autofac.dll dependencies in ILDASM under MANIFEST section showed that:
.assembly extern retargetable System.Core
{
.publickeytoken = (7C EC 85 D7 BE A7 79 8E ) // |.....y.
.ver 2:0:5:0
}
The beta version of autofac (Autofac 3.0.0-beta) is using an old System.Core, it is build against .NET in a version 4.0 but yet it is using System.Core in version 2.0, how bizarre.
I uninstalled autofac in this version, and took an older one
uninstall-package autofac
Install-Package Autofac -Version 2.6.3.862
A quick check at dependencies
.assembly extern System.Core
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
Looks good, and it solved my problem, but why they used a System.Core in version 2.0.5.0 I do not know, probably they haven't noticed yet.
No comments:
Post a Comment