Identifying the .NET version you are running (2.0, 4.5, 4.5.1 or 4.5.2)

 

.NET 2.0 to 3.5

These version shares the same runtime and the version starts with 2.0.50727 followed by the build number. The file that will tell us the version being used is mscorwks.dll. You may choose other files as well, but this one will be present both in the file system if you want to check it in general as in a dump file. To check in the file system which version of .NET you are using, navigate to the .NET install folder (normally C:\Windows\Microsoft.NET\Framework\v2.0.50727), locate file mscorwks.dll, right click and choose Properties… in the context menu. The full version will be in the details tab:

image

The version is 2.0.50727.8645. What is important here is the build number (8645) which will tell how recent it is compared to RTM (Release to Manufactory) version. It also will tell if you need a particular update. For example, KB 2898868 includes hotfix to resolve some security issues. The notes in file information tells us that mscorwks.dll was updated to 2.0.50727.8000. As 8645 is more recent than 8000 this security update is already incorporated in the built. Just be careful here because sometimes the update applies to other components and you should verify the file affected against yours. If you try to install an update already installed you will be alerted, so feel free to apply the patch “just in case”.

If you have a dump file or is performing a live debug with WinDbg, you can check the version with command lmv m mscorwks as below:

0:000> lmv m mscorwks start end module name 00000642`7f330000 00000642`7fcdc000 mscorwks (deferred) Image path: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll Image name: mscorwks.dll Timestamp: Wed May 12 00:13:32 2010 (4BEA38FC) CheckSum: 0099D95F ImageSize: 009AC000 File version: 2.0.50727.4455 Product version: 2.0.50727.4455 File flags: 0 (Mask 3F) File OS: 4 Unknown Win32 File type: 2.0 Dll File date: 00000000.00000000 Translations: 0409.04b0 CompanyName: Microsoft Corporation ProductName: Microsoft® .NET Framework InternalName: mscorwks.dll OriginalFilename: mscorwks.dll ProductVersion: 2.0.50727.4455 FileVersion: 2.0.50727.4455 (QFE.050727-4400) FileDescription: Microsoft .NET Runtime Common Language Runtime - WorkStation LegalCopyright: © Microsoft Corporation. All rights reserved. Comments: Flavor=Retail

We see that this build (4455) is before that security hotfix and it would be a very good idea to patch this machine where this dump was captured.

.NET 4.0, 4.5, 4.5.1 and 4.5.2

Unlike .NET 3.5 which share the same runtime with .NET 2.0, .NET 4.5 and beyond DOES NOT share the runtime with .NET 4.0. However, when you update your system to use .NET 4.5 and beyond, all your .NET 4.0 application will run as .NET 4.5. There is no way to make 4.5 and 4.0 to coexist as you can do with .NET 2.0 and .NET 4.0. To make things more challenging, .NET 4.5, 4.5.1 and .NET 4.5.2 share the same version number as .NET 4.0 which is 4.0.30319. So, how can you tell which version you are running? You can use the same methods you used for .NET 2.0, except that the file of interest is rather clr.dll normally at C:\Windows\Microsoft.NET\Framework\v4.0.30319. See figure below:

image

 

The build is 18010 which means it is .NET 4.5. Below is a list with the approximate build range for each version:

.NET Version Clr.dll Build 4.0.30319.<Build>)
.NET 4.0 4.0.30319.0 to 4.0.30319.17000
.NET 4.5 4.0.30319.17001 to 4.0.3019.18400
.NET 4.5.1 4.0.30319.18401 to 4.0.30319.34000
.NET 4.5.2 From 4.0.30319.34000

To verify the version from a dump file in windbg, run the command lmv m clr

0:000> lmv m clr
start end module name
000007f8`3b300000 000007f8`3bc5e000 clr (deferred)
Image path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Image name: clr.dll
Timestamp: Sat Aug 25 01:54:04 2012 (5038768C)
CheckSum: 00967D93
ImageSize: 0095E000
File version: 4.0.30319.18010
Product version: 4.0.30319.18010
File flags: 8 (Mask 3F) Private
File OS: 4 Unknown Win32
File type: 2.0 Dll
File date: 00000000.00000000
Translations: 0409.04b0
CompanyName: Microsoft Corporation
ProductName: Microsoft® .NET Framework
InternalName: clr.dll
OriginalFilename: clr.dll
ProductVersion: 4.0.30319.18010
FileVersion: 4.0.30319.18010 built by: FX45RTMGDR
PrivateBuild: DDBLD323
FileDescription: Microsoft .NET Runtime Common Language Runtime - WorkStation
LegalCopyright: © Microsoft Corporation. All rights reserved.
Comments: Flavor=Retail

 

.NET 4.5.3

The product team came back to senses (partially) with .NET 4.5.3 . Still in preview, clr.dll comes with a different version 4.5.22, however it is for now still located at C:\Windows\Microsoft.NET\Framework\v4.0.30319. This all may change when the final version is released.

0:000> lmv m clr
start             end                 module name
00007ffd`56720000 00007ffd`5706e000   clr        (deferred)            
    Image path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
    Image name: clr.dll
    Timestamp:        Fri Oct 03 21:18:02 2014 (542F58DA)
    CheckSum:         0094AB4B
    ImageSize:        0094E000
    File version:     4.5.22.0
    Product version:  4.0.30319.0
    File flags:       8 (Mask 3F) Private
    File OS:          4 Unknown Win32
    File type:        2.0 Dll
    File date:        00000000.00000000
    Translations:     0409.04b0
    CompanyName:      Microsoft Corporation
    ProductName:      Microsoft® .NET Framework
    InternalName:     clr.dll
    OriginalFilename: clr.dll
    ProductVersion:   4.5.22.0
    FileVersion:      4.5.22.0 built by: FX453PREVIEWREL
    PrivateBuild:     DDBLD046C
    FileDescription:  Microsoft .NET Runtime Common Language Runtime - WorkStation
    LegalCopyright:   © Microsoft Corporation.  All rights reserved.