Reputation: 1376
Upon running this code:
foreach (string drive in Environment.GetLogicalDrives())
Console.WriteLine("Drive: {0}", drive);
Console.WriteLine("OS: {0}", Environment.OSVersion);
Console.WriteLine("Processor count: {0}", Environment.ProcessorCount);
Console.WriteLine(".NET version: {0}", Environment.Version);
I get
When I downloaded and started the .NET installer, I was told that the 4.5 version was already installed. Is there a difference between the version name, and the actual version number?
Upvotes: 0
Views: 463
Reputation: 5404
Starting with .NET Core 3.0 (and .NET Standard 2.1) situation is changed and now Environment.Version
working properly.
System.Console.WriteLine($"Environment.Version: {System.Environment.Version}");
// Old result
// Environment.Version: 4.0.30319.42000
//
// New result
// Environment.Version: 3.0.0
See documentation for further information.
Upvotes: 0
Reputation: 1500185
Yes - basically .NET 4.5 is an in-place replacement for .NET 4.0, so Environment.Version
will return the same version number for the first 3 parts. The build part of the version number (18010 in your case) is different between .NET 4.0 and .NET 4.5 (and potentially updates to each) but the major/minor/patch level is 4.0.30319 in both cases.
It's confusing as heck, but that's the situation, I'm afraid.
Upvotes: 4
Reputation: 498972
.NET 4.5 is a drop-in replacement for 4.0 - the version number is indeed what you see.
Check the versions of the assemblies in the reference assemblies directory.
Upvotes: 2