When trying to run a MVC sample provided by a Vendor for trialling a API, I get the following error:
[StructureMapConfigurationException: StructureMap configuration failures: Error: 170 Source: Registry: StructureMap.Configuration.DSL.Registry, StructureMap, Version=2.6.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223 Unable to find the exported Type's in assembly Groupdocs.Web.UI.Comparison, Version=2.0.5205.21794, Culture=neutral, PublicKeyToken=c9073b8a6a9c78c8. One or more of the assembly's dependencies may be missing.
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=null'
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) at System.Reflection.RuntimeAssembly.GetExportedTypes() at StructureMap.Graph.TypePool.<>c__DisplayClass2.<.ctor>b__0(Assembly assembly)
Seems specifically to do with Log4net but I have got the correct reference for the project and version (1.2.10), interestingly when I try the same project from another machine it works so not sure what the actual issue is. I have checked the GAC and there are no log4net references.
The error says: "A strongly-named assembly is required"
I think you should either add a strong named key to the log4net that you use, or remove a strong named key from your application.
There must be a DLL somewhere along the line which is referencing an older version of log4net. You can't imagine how often we get these similar problems in our project. The solution is simply to find all the project which depend on log4net and upgrade their version. The latest version of log4net is 1.2.13. There must be a DLL somewhere in your app which is still relying on older version which is in your case 1.2.10. update-package -Id log4net
Primitive Yet Handy Solution:
1 - Build the entire solution and make sure the project successfully compiles and builds.
2 - Search the solution folder (In visual Studio right click on the solution and "Open Folder in File Explorer") for all instances of log4net.dll
3 - In your case it is highly likely that you will see different versions of the same DLL in your projects bin folder. Comparing those DLLs will lead you to the DLL which is different than the rest of the solution.
In you config you do not have the public key token specified, check if your config contains:
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=1B44E1D426115821"/>
This will load the log4net assembly by its strong name.
User contributions licensed under CC BY-SA 3.0