title: Migrate Enterprise Library 5 to 6
body: <p>Trying to move from <a href="https://entlib.codeplex.com/" rel="nofollow">Enterprise Library</a> 5.0 to 6.0, I ran into some troubles. Maybe this will help others.</p>
  
  <p>Following configuration is an example for (silent) exception logging to database:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;configSections&gt;
    &lt;section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging" requirePermission="true" /&gt;
    &lt;section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" requirePermission="true" /&gt;
  &lt;/configSections&gt;
  &lt;loggingConfiguration name="" tracingEnabled="true" defaultCategory="General"&gt;
    &lt;listeners&gt;
      &lt;add name="Database Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database"
           listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database"
           databaseInstanceName="LogContext" writeLogStoredProcName="WriteLog"
           addCategoryStoredProcName="AddCategory" formatter="Text Formatter" /&gt;
    &lt;/listeners&gt;
    &lt;formatters&gt;
      &lt;add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging"
           template="Timestamp: {timestamp}{newline}..."
           name="Text Formatter" /&gt;
    &lt;/formatters&gt;
    &lt;categorySources&gt;
      &lt;add switchValue="All" name="Exception"&gt;
        &lt;listeners&gt;
          &lt;add name="Database Trace Listener" /&gt;
        &lt;/listeners&gt;
      &lt;/add&gt;
    &lt;/categorySources&gt;
  &lt;/loggingConfiguration&gt;
  &lt;exceptionHandling&gt;
    &lt;exceptionPolicies&gt;
      &lt;add name="UiPolicy"&gt;
        &lt;exceptionTypes&gt;
          &lt;add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
               postHandlingAction="None"&gt;
            &lt;exceptionHandlers&gt;
              &lt;add name="Logging Exception Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging"
                   logCategory="Exception" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
                   formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"
                   priority="0" /&gt;
            &lt;/exceptionHandlers&gt;
          &lt;/add&gt;
        &lt;/exceptionTypes&gt;
      &lt;/add&gt;
    &lt;/exceptionPolicies&gt;
  &lt;/exceptionHandling&gt;
  </code></pre>
  
  <p>I'm using following assemblies with version 5.0.414.0:</p>
  
  <blockquote>
    <p>Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
    Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging 
    Microsoft.Practices.EnterpriseLibrary.Logging
    Microsoft.Practices.EnterpriseLibrary.Logging.Database</p>
  </blockquote>
  
  <p>With Enterprise Library 5.0 using all this within a asp.net MVC app is as easy as:</p>
  
  <pre><code>// ...
  catch (Exception ex)
  {
      if (ExceptionPolicy.HandleException(ex, "UiPolicy")) throw;
      // do something else
  }
  </code></pre>
  
  <p>After upgrading the assemblies to Enterprise Library 6.0, I get following exception message:</p>
  
  <blockquote>
    <p>Must set an ExceptionManager in the ExceptionPolicy class using the SetExceptionManager method.</p>
  </blockquote>
  
  <p>So, what to do?</p>