assembly file load error

Z

Zeng

I randomly got this error:

"System.IO.FileLoadException: The located assembly's manifest definition
with name 'ClientToolLib' does not match the assembly reference."

I noticed that in the production server, there are a few different versions
of ClientToolLib.dll (strong named), one for each apps. My production
servers contain multiple applications that can load up its own version of
ClientToolLib.dll. So is it the case that each server can load up exactly
one dll for each name? If that's the case then it would explain why I got
the random error.

Thanks for any comment or advice.
 
R

Richard Grimes [MVP]

Zeng said:
I randomly got this error:

"System.IO.FileLoadException: The located assembly's manifest
definition with name 'ClientToolLib' does not match the assembly
reference."

I noticed that in the production server, there are a few different
versions of ClientToolLib.dll (strong named), one for each apps. My
production servers contain multiple applications that can load up its
own version of ClientToolLib.dll. So is it the case that each
server can load up exactly one dll for each name? If that's the case
then it would explain why I got the random error.

If the library has a strong name then .NET will only load the specific
version of the library that is in the calling assembly's manifest. If that
specific version is not available (locally, or in the GAC) then you'll get
an exception.

You can alleviate this issue at development time by providing a config file
to redirect the versions, but that's not a solution for production code. The
only safe solution is to make sure that all assemblies in the application
use the same version of the library. If you cannot do that, then make sure
that the GAC has all of the required versions. If you have multiple apps and
each requires a different version of the library, then when you deploy your
product you should deploy all the required versions of the library and
install all of them in the GAC or in each app's folder.

More details:

http://www.grimes.demon.co.uk/workshops/fusionWS.htm

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top