views:

52

answers:

4

I have an old dll that was compiled against the .NET framework and deployed. I am not sure which version of the .NET framework it was compiled against. I am wondering how I can determine which version of the .NET framework this dll was compiled against? I cannot trust the source code because I believe it has been upgraded to Visual Studio 2008 and changed to .NET framework version 3.5.

+1  A: 

Load it into Reflector and see what it references?

ParmesanCodice
My idea too, but knowing reflector, it will probably complain, and give it a nice non-descript error icon.
leppie
@leppie Shouldn't be a problem, even if it's .NET 1.1. Just change your default assembly list.
ParmesanCodice
Thanks for your help. Reflector to the rescue once again.
mpenrow
A: 

Decompile it with ILDASM, and look at the version of mscorlib that is being referenced (should be pretty much right at the top).

leppie
A: 

You can use ILDASM...

ildasm.exe C:\foo.dll /metadata[=MDHEADER] /text /noil
Josh Stodola
A: 

You have a few options: To get it programmatically, from managed code, use Assembly.ImageRuntimeVersion:

Dim a As Assembly = Reflection.Assembly.ReflectionOnlyLoadFrom("C:\path\assembly.dll")
Dim s As String = a.ImageRuntimeVersion

From the command line, starting in v2.0, ildasm.exe will show it if you double-click on "MANIFEST" and look for "Metadata version". Determining an Image’s CLR Version

Ben Griswold