Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check the version of the .NET Framework that a DLL file was compiled against? [duplicate]

Possible Duplicate:
Determine framework (CLR) version of assembly

I have a library/DLL file which is compiled in the .NET Framework.

Now (without any coding) I would like to check the .NET Framework version which was used to compile this library. I need to know was it 2.0, 3.5, or 4.0. Is there any tool that help me to achieve this? (I know that it should be compiled under version 4.0 of the Framework, but I need to be 100% sure that version 4.0 of the Framework was used).

like image 432
truthseeker Avatar asked Dec 15 '10 11:12

truthseeker


3 Answers

You must use ILDASM. you double click the manifest and you get

// Metadata version: v2.0.50727

or

// Metadata version: v4.0.30319

Framework 3.0 and 3.5 are not really new releases of the CLR, so you will keep having V2.0. At most, you can guess which framework you will need by cheching the dependencies. Some dlls are available only in 3.5, but if you manually copy them in a 2.0 only PC the app will work. Check C:\windows\Microsoft.NEt\Framework and you will find them in their according folder.

Hope this helps

like image 191
Daniel Dolz Avatar answered Oct 05 '22 15:10

Daniel Dolz


If you have it as a reference in a project. You should be able to look at the Runtime version under properties for that reference. No coding required =-)

alt text

like image 20
Brosto Avatar answered Oct 05 '22 16:10

Brosto


Use ILDASM or Reflector to inspect the assembly manifest and see the version of the System.* assemblies that where referenced.

For example, using ILDASM to view the manifest of a .NET assembly I can see that this was built targeting Framework 1.1

// Metadata version: v1.1.4322
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 1:0:5000:0
}
.assembly extern System.Web
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 1:0:5000:0
}
.assembly extern System
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 1:0:5000:0
}
.assembly extern ICSharpCode.SharpZipLib
{
  .publickeytoken = (1B 03 E6 AC F1 16 4F 73 )                         // ......Os
  .ver 0:84:0:0
}
.assembly ReverseProxy
{

  // --- The following custom attribute is added automatically, do not uncomment -------
  //  .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool,
  //                                                                                bool) = ( 01 00 00 01 00 00 ) 

  .hash algorithm 0x00008004
  .ver 0:0:0:0
}
.module ReverseProxy.dll
// MVID: {3F1B8B81-1B8F-4DD7-A71F-FD019C095F25}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY
// Image base: 0x010A0000
like image 41
Chris Taylor Avatar answered Oct 05 '22 15:10

Chris Taylor