Enterprise Library 5.0 Logging Application Block Database Trace Listener and .NET 4 Client Profile

Posted by on Comments (6)

The new Enterprise Library 5.0 was launched a few days before and I decided to use this new version in my projects. One of the main application block I'm using is the Logging Application Block.

I went to use it in a WCF Service Library into Visual Studio 2010. Everything was fine until I decided to use a Database Trace Listener. Of course, I referenced the Microsoft.Practices.EnterpriseLibrary.Logging.Database in my project. But it always failed to run with this message:

"Invalid TraceListenerData type in configuration 'listenerDataType=\"Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\"'."

Finally, I found that you need to work with the .NET 4.0 Full Framework and not only the Client Profile. Some assemblies are needed by the Database Trace Listener that are not present in the Client Profile (to learn more about the differences between the Full Framework and the Client profile, go here).

So, just target your project to the .NET Framework 4 and everything will be fine.