We help IT Professionals succeed at work.

How do I know which assembly is which?

juststeve
juststeve asked
on
Medium Priority
1,275 Views
Last Modified: 2013-11-26
Working with the QuickStarts for the EnterpriseLibrary... I've used an existing project as a jumping off point for my project and want to use the Release version of the logging.dll instead of the debug version that was used by the original project. I've built the release version and have pointed all of my references to the path containing the new version but get this error when at runtime.

            Message      "An error occurred creating the configuration section handler for loggingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I need guidance understanding the relationship between the config information and the project's referenced assemblies. Details on understanding where VS thinks it should find referenced DLLs.
Comment
Watch Question

Try running the fusion log viewer.. the logging will tell you exactly where it will search for assemblies

Visual studio cmd prompt -> fuslogvw
then enable the log (to screen, or file, what you prefer)

then run your app, and check the fuslog for errors.
But the error you have could e.g. by caused by not referencing the Microsoft.Practices.EnterpriseLibrary.DataBase when you configure the logging block to use database logging...
Sachintana DissanayakeSenior Web Developer
CERTIFIED EXPERT

Commented:
You need to have dll references to,
    Microsoft.Practices.EnterpriseLibrary.Logging.dll
    Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.dll
    Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.Design.dll

Since logging configuration section in the web.config will need all of the above references in the run time.

Author

Commented:
*** Assembly Binder Log Entry  (1/29/2008 @ 3:50:53 AM) ***

The operation failed.
Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from:  c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\CMSwApp\bin\Debug\CMS_WinForm.vshost.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = CHI01-019-21\Administrator
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/Documents and Settings/Administrator/My Documents/Visual Studio 2008/Projects/CMSwApp/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\CMSwApp\bin\Debug\CMS_WinForm.vshost.exe.Config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/My Documents/Visual Studio 2008/Projects/CMSwApp/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Logging.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\CMSwApp\bin\Debug\Microsoft.Practices.EnterpriseLibrary.Logging.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.


You will see the lookup path in the pasted log:
LOG: GAC Lookup was unsuccessful.

so, first GAC
Then application path.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: The assembly reference did not match the assembly definition found.

Have you tried cleaning your solution and then rebuilding it?
If you linked to the 'source' version of the EL before, that version was not signed as far as I remember.
I believe the 3.1 version came with a signed set of dll's that gets copied into a seperate folder.
You can reference to these dll's instead.


Sachintana DissanayakeSenior Web Developer
CERTIFIED EXPERT

Commented:
Install enterprise library, it will install those assemblies to GAC.
http://www.microsoft.com/downloads/details.aspx?FamilyID=4c557c63-708f-4280-8f0c-637481c31718
@sachintana, that's nice on your dev machine, but you don't want it to install on all your deployment targets like that i suppose
Sachintana DissanayakeSenior Web Developer
CERTIFIED EXPERT

Commented:
You should add these assemblies to GAC or
Add these dll's in to your web project as dll references.
    Microsoft.Practices.EnterpriseLibrary.Logging.dll
    Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.dll
    Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.Design.dll