Type cannot be resolved

Oct 13, 2010 at 8:38 PM

Hi,

I am using Enteprise Library 5 for exception handling and loggin.

The configuration is actually in a .dll which is used in different project.

In order to access the configuration file I use the following code:

FileConfigurationSource

 

exceptionsSource = new FileConfigurationSource(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "EnterpriseLibrary.config"

));

 

ExceptionPolicyFactory exceptionFactory = new ExceptionPolicyFactory

(exceptionsSource);

Policy = exceptionFactory.Create(

"ExceptionLogPolicy"

);

This code works well in two different application that reference the .dll, both Windows forms application.

However, I have a third scenario where I need to reference that .dll within another .dll which is COM visible

When the above code is executed I get the following error:

The type 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling' cannot be resolved. Please verify the spelling is correct or that the full type name is provided

I have verified that the .dlls are copied to the bin directory, of both  .dlls (the one which uses the Enteprise Library and the one that calls it).

I cannot find a reason for this happening.

Any idea of what I am doing wrong?

Oct 13, 2010 at 10:57 PM

I'd pull out the Fusion log viewer (fuslogvw) and what what DLLs and directories it's actually looking in.

 

Oct 14, 2010 at 2:28 PM

I solved the problem,

there is a problem with the config tool, for some reason, the entry for TextFormatter didn't specify the version, culture and public key token of the assembly.

 

It seems it's not a problem in most cases, but when the caller is com visible it is.