Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reliably detect the actual .NET 4.5 version installed?

Tags:

.net

.net-4.5

My actual problem is that I have encountered two versions of .NET 4.5 full setups:

  • a (possibly) older one, which is also available when downloading SQL Server Data Tools
    • size: 50,349,920
    • md5: a5e81d1b3905ada0a6e35fd6c6a2e1f4
  • a (possibly) newer one downloaded this morning from here: http://www.microsoft.com/visualstudio/eng/downloads
    • size: 50,352,408
    • md5: d02dc8b69a702a47c083278938c4d2f1

The version for both setups is 4.5.50709.17929. Inside, the main difference is the netfx_Full.mzz file, but after extracting the content with 7-zip I end up with a lot of files with the same version, even if the file content is different (I have checked about 20 random files from about 426), so I can't really tell which one is newer.

Is there a way to reliably detect the actual version of the installed .NET 4.5 runtime, so I can run the setup only if it's really required?

Update

I have checked all the 426 files that have different content, and all of them are having the same ProductVersion and FileVersion in both setups. So, registry or file checksums are the next step.

Update 2

The version listed in the registry is the same for both setups: 4.5.50709

Update 3

.NET 4.5.2 is now available:

This version of the .NET Framework runs side-by-side with the .NET Framework 3.5 SP1 and earlier versions, but performs an in-place update for the .NET Framework 4, .NET Framework 4.5 and .NET Framework 4.5.1.

like image 321
alexandrul Avatar asked Oct 19 '12 10:10

alexandrul


People also ask

How do you check if .NET 4.5 is installed?

The version of .NET Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. If the Full subkey is missing, then .NET Framework 4.5 or above isn't installed.

How do I know my net framework exact version?

Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator option. Type the following command to determine the version of . NET installed and press Enter: reg query "HKLM\SOFTWARE\Microsoft\Net Framework Setup\NDP" /s To make sure that version 4.

How do you check if I have .NET 5 installed?

The documented way to check the version is to launch dotnet --info or dotnet --list-runtimes and inspect the results.


1 Answers

MS recently patched .NET 4.5 to restore backwards compatibility with .NET 4.0 in some scenarios (see http://blogs.msdn.com/b/dotnet/archive/2012/10/17/net-framework-4-5-off-to-a-great-start.aspx).

It's possible that MS updated the setup with these changes (so that users upgrading to .NET 4.5 don't run into compat trouble), though I don't know why they wouldn't change the version number on the setup.

Also, note that there's a difference between the .NET version number and the runtime version number as reported by System.Environment.Version. The latter still is 4.0.30319.* for .NET 4.5, only the revision number changes (with the .NET 4.5 update, and also with every security update).

Here are some examples of runtime versions observed in the wild:

Base 4.0

  • 4.0.30319.1 = .NET 4.0 RTM
  • 4.0.30319.269 = .NET 4.0 on Windows XP SP3, 7, 7 SP1 (with MS12-035 GDR security update)
  • 4.0.30319.276 = .NET 4.0 on Windows XP SP3 (4.0.3 Runtime update)
  • 4.0.30319.296 = .NET 4.0 on Windows XP SP3, 7 (with MS12-074 GDR security update)
  • 4.0.30319.544 = .NET 4.0 on Windows XP SP3, 7, 7 SP1 (with MS12-035 LDR security update)
  • 4.0.30319.1008 = .NET 4.0 on Windows XP SP3, 7, 7 SP1 (with MS13-052 GDR security update)
  • 4.0.30319.1022 = .NET 4.0 on Windows XP SP3, 7, 7 SP1 (with MS14-009 GDR security update)
  • 4.0.30319.1026 = .NET 4.0 on Windows XP SP3, 7, 7 SP1 (with MS14-057 GDR security update)
  • 4.0.30319.2034 = .NET 4.0 on Windows XP SP3, 7, 7 SP1 (with MS14-009 LDR security update)

4.5

  • 4.0.30319.17626 = .NET 4.5 RC
  • 4.0.30319.17929 = .NET 4.5 RTM
  • 4.0.30319.18010 = .NET 4.5 on Windows 8
  • 4.0.30319.18052 = .NET 4.5 on Windows 7 SP1 64-bit
  • 4.0.30319.18063 = .NET 4.5 on Windows 7 SP1 64-bit (with MS14-009 security update)

4.5.1

  • 4.0.30319.18408 = .NET 4.5.1 on Windows 7 SP1 64-bit
  • 4.0.30319.18444 = .NET 4.5.1 on Windows 7 SP1 64-bit (with MS14-009 security update)
  • 4.0.30319.34014 = .NET 4.5.1 on Windows 8.1 64-bit

4.5.2

  • 4.0.30319.34209 = .NET 4.5.2 on Windows 7 SP1 64-bit
  • 4.0.30319.34209 = .NET 4.5.2 on Windows 8.1 64-bit

4.6 and later

  • 4.0.30319.42000

I don't see any .NET updates in my Windows Update history, so I guess the update to v18010 got installed as part of KB 2756872.

Update: apparently Microsoft updated the .NET 4.5 setup due a mistake with the digital signatures in the original download. KB 2770445.

like image 176
Daniel Avatar answered Oct 17 '22 02:10

Daniel