title: Enterprise Library Exception Handling Block Change between VS 2008 and VS2012
body: <p>I have migrated my asp.net web application from Visual Studio 2008 to Visual Studio 2012. It is working except one case.</p>
  
  <p>Some place they capture exception and throw it which is captured in Global.asax in Application_Error Event. This error is shown in Custom Error Page. It works in VS2008 but in VS 2012 it shows following error when we debug.</p>
  
  <blockquote>
    <p>An exception of type 
    'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingExcep> tion' occurred in Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll > but was not handled in user code</p>
    
    <p>Additional information: Could not load file or assembly  >'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, >PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located >assembly's manifest definition does not match the assembly reference. >(Exception from HRESULT: 0x80131040)</p>
  </blockquote>
  
  <p>If there is a handler for this exception, the program may be safely continued.</p>
  
  <p>The above error is raised in ExceptionPolicy.HandleException(error, "OIMPolicy") statement.</p>
  
  <p><pre>
   protected void Application_Error(Object sender, EventArgs e)
          {
              Exception error = Server.GetLastError();</p>
  
  <code>        if (error != null)
          {
              Server.ClearError();
              if (error.InnerException != null)
                  error = error.InnerException;
  
              ExceptionPolicy.HandleException(error, "Policy");
          }
      }
  </code></pre>
  
  <p></p>
  
  <p>The above code works with old enterprise library on VS 2008. But it does not work in VS2012.</p>
  
  <p>Can anyone suggest what enterprise library to use on VS 2012 or what is the fix for the above.</p>