views:

255

answers:

3

Hey folks, I've got an ASP.NET web site project that for some reason is insisting on referencing both mscorlib 1.0.5 and mscorlib 2.0, and I can't figure out why.

I've analyzed all the referenced DLLs using NDepend, and they all appear to only reference mscorlib 2.0. I've got a couple web references, but I can't imagine why that would create an additional reference to the 1.0 dll.

Anyone have any ideas why I'd be getting this additional reference, or what I can use to find out that information? NDepend is great, but just comes back and says "found 2 references, using the newer version", so it doesn't help me figure out why I have the extra reference...

A: 

Try removing the reference and recompiling - that will tell you what (if anything) depends on the older version.

Andrew Hare
You can't unfortunately add/remove references to mscorlib directly...
jvenema
A: 

An errant refernence may be residing in your web.config file.

Kindness,

Dan

Daniel Elliott
+2  A: 

I think at this point your best bet is to use ildasm. Using ildasm on the assembly will bring up a node named "Manifest". Double click on that node and it will dump out the IL representation of assembly references including the referenced version number. Repeat this for all of your DLL's until you find the one referencing the 1.0 version.

EDIT

Another possible solution would be to enumerate the Assembly values and there associated GetReferencedAssemblies method. This will return an array of AssemblyName values which have a corresponding Version member. This should contain the actual version of the referenced assembly vs. the one that was actually loaded.

I'm not 100% sure on this matter and don't have a convenient way to test it right now.

JaredPar
I was afraid that might be the answer :) Looks like I've got a fun few hours ahead of me...
jvenema
Thanks Jared, just checking them manually went faster than I thought, and I found the culprit.
jvenema