I am working on a project and decided to go with StructureMap as an IoC, but whenever we try to load a project (MVC 3 by the way), we get this error:
Failed to load file or assembly 'StructureMap, Version = 2.5.3.0, Culture = neutral, PublicKeyToken = e60ad81abae3c223' or one of its dependencies. The system cannot find the specified file.
In Global.asax, I have this code to initialize StructureMap
ObjectFactory.Initialize( x => { x.ForRequestedType<IUnitOfWorkFactory>() .TheDefaultIsConcreteType<EFUnitOfWorkFactory>() .CacheBy(InstanceScope.HttpContext); x.ForRequestedType(typeof(IRepository<>)) .CacheBy(InstanceScope.HttpContext) .TheDefaultIsConcreteType(typeof(GenericRepository<>)); });
And I have StructureMap in the lib folder that I added to the main MVC application. Even when deleting all the links that I can find, I still get this error.
For the record, this is the lib folder in the MVC3 structure

And I add a link to StructureMap.dll (which, oddly enough, is version 2.6.1, but the error says version 2.5.3.0
] Forgot to mention that I have a Factory user controller for StructueMap. Here is the factory controller code:
public class StructureMapControllerFactory : DefaultControllerFactory { protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) { try { return (controllerType == null) ? null : ObjectFactory.GetInstance(controllerType) as Controller; } catch (StructureMapException) { System.Diagnostics.Debug.WriteLine(ObjectFactory.WhatDoIHave()); throw; } } }
And this is how I use it in the Global.asax.cs file
ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory());
EDIT: I installed StructureMap with NuGet and still get the same error, although NuGet installed a different version (2.6 instead of 2.5), but still get a 2.5 error. Therefore, I am going to offer generosity to everyone who can help me solve this problem.
EDIT 2 I uninstalled and then reinstalled Visual Studio and Entity Framework, when I try to add POCO, I get this error 
Does anyone know how to solve this?
EDIT 3: I removed CTP using the technique located here , I removed CTP and version 4.1 then follow the instructions and the link provided, and when I follow the instructions, I get this error message
. This has reached a critical mass, and my employer is rather upset because of me because I do not seem to allow the error message above. Has anyone received answers to my questions?
EDIT 4:. It works locally with IIS 7.5 Express, now you need to make it work on a real server. It's funny that I'm using StructureMap 2.6.2, but the error (for some reason) is looking for 2.5.3. I searched and searched for an attempt to find a link to StructureMap 2.5.3.
EDIT 5: Works perfect, but with the same error on a live site. I work remotely and we use SVN to manage the source code, and another developer works remotely, but he, like my code, never makes it for production, and, of course, I do not have access to the current site.