title: Could not load file or assembly 'StructureMap, Version=2.5.3.0
body: <p>I'm working on a project and decided to go with StructureMap as the IoC, but whenever we try to load the project (MVC 3 by the way) we get this error:</p>
  
  <blockquote>
    <p>Could not load file or assembly
    'StructureMap, Version=2.5.3.0,
    Culture=neutral,
    PublicKeyToken=e60ad81abae3c223' or
    one of its dependencies. The system
    cannot find the file specified.</p>
  </blockquote>
  
  <p>In Global.asax I have this code to initialize StructureMap</p>
  
  <pre><code>ObjectFactory.Initialize(
      x =&gt;
      {
          x.ForRequestedType&lt;IUnitOfWorkFactory&gt;()
              .TheDefaultIsConcreteType&lt;EFUnitOfWorkFactory&gt;()
              .CacheBy(InstanceScope.HttpContext);
  
          x.ForRequestedType(typeof(IRepository&lt;&gt;))
              .CacheBy(InstanceScope.HttpContext)
              .TheDefaultIsConcreteType(typeof(GenericRepository&lt;&gt;));
  
      });
  </code></pre>
  
  <p>And have StructureMap in a lib folder I added to the main MVC application. Even when removing all references that I can find I still get this error.</p>
  
  <p>For the record this is the <strong>lib</strong> folder in the MVC3 structure</p>
  
  <p><img src="https://i.stack.imgur.com/DxM4F.png" alt="enter image description here"></p>
  
  <p>And I add reference to the StructureMap.dll (which oddly enough is version 2.6.1 but the error says version 2.5.3.0</p>
  
  <p>]
  Forgot to mention that I have a custom Controller Factory for StructueMap. Here's the code for the controller factory:</p>
  
  <pre><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;
          }
      }
  }
  </code></pre>
  
  <p>And here's how I use it in the Global.asax.cs</p>
  
  <pre><code>ControllerBuilder.Current.SetControllerFactory(new StructureMapControllerFactory());
  </code></pre>
  
  <p><strong>EDIT:</strong> I installed StructureMap with NuGet and still get the same error, though NuGet installed a different version (2.6 instead of 2.5) but still get the 2.5 error. So I'm going to offer a bounty to anyone who can help me resolve this issue</p>
  
  <p><strong>EDIT 2</strong> I uninstalled then re-installed Visual Studio and Entity Framework, when I try to add POCO's I get this error <img src="https://i.stack.imgur.com/HkI99.png" alt="enter image description here"></p>
  
  <p>Anyone know how to resolve this?</p>
  
  <p><strong>EDIT 3:</strong> I uninstalled the CTP using the technique located <a href="http://blogs.msdn.com/b/adonet/archive/2011/06/30/announcing-the-microsoft-entity-framework-june-2011-ctp.aspx" rel="nofollow noreferrer">here</a>, I uninstalled the CTP and version 4.1 then followed the instructions located and the link I provided and when I followed the instructions I get this error message <img src="https://i.stack.imgur.com/vxuKl.png" alt="enter image description here">. This is has reached critical mass and my employer is getting rather upset with me because I cant seem to resolve the error message above. Anyone got any answers for me?</p>
  
  <p><strong>EDIT 4:</strong> Got it working locally with IIS 7.5 Express, now need to get it working on the live server. Funny thing is I'm using StructureMap 2.6.2 but the error (for some reason) is looking for 2.5.3. I've searched and searched trying to to find a reference to StructureMap 2.5.3.</p>
  
  <p><strong>EDIT 5:</strong> Works perfect locally but same error on live site. I work remotely and we use SVN for source control and the other developer works remotely but it's like my code never makes it to production, and of course I don't have access to the live site</p>