Using MSTest I get - "Invalid TraceListenerData type in configuration"

Topics: Data Access Application Block, Logging Application Block
Jul 25, 2014 at 8:55 AM
Hi, I am getting the error "Invalid TraceListenerData type in configuration" when using MS Test, the EL objects work fine in my main project.

I have done some reading around on the subject and I have found the issue but not how to resolve it. It seems that the "Microsoft.Practices.EnterpriseLibrary.Logging.Database.dll" is not being copied to the output directory of the Test. FYI...the full error details are below:

System.Configuration.ConfigurationErrorsException: Invalid TraceListenerData type in configuration 'listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"'. (C:\supplierportal.root.aedwards\SupplierPortal\TestResults\andy.edwards_GREENSTONEPC25 2014-07-25 09_44_44\Out\GS.Tests.DLL.config line 156). Aborting test execution.

The "Microsoft.Practices.EnterpriseLibrary.Logging.Database" reference is set to Copy Local . I have deleted and re-imported this dll. It looks exactly the same as all the other EL dll's.

Do you know how to resolve this?

Jul 28, 2014 at 8:34 AM
Anyone have any ideas or suggestions??
Jul 28, 2014 at 1:16 PM
As you mention, the error usually occurs because the assembly is not copied to the output folder. You can verify by looking into the unit test folder. Since the Logging Database assembly is a soft reference it may not be copied. In a Unit Test you can force deployment of the assembly using the DeploymentItemAttribute as per this thread:

Another post also goes through a variety of ways to ensure the assembly is deployed (xcopy build event, attribute, build target, etc) :

Randy Levy
Enterprise Library support engineer
Support How-to