Barry Luijbregts has an interesting video of the current .NET eco system on Pluralsight which I recommend you watch but in the meantime, he talked about some interesting facts about how .NET versioning works together with where it is installed, which I thought worth repeating.
Let’s start with the versions and explain what the components of the latest .NET version (4.6.1) mean.
- 4: This is the current CLR (Common Language Runtime) version which only increments when something really big has changed.
- 6: This number only changes when new libraries are added or modified.
- 1: This relates to minor big fixes.
There are other numbers which you can sometimes see when releases are made but they relate to tiny differences and can be ignored, mostly.
What you might not realise is that the frameworks can be installed side-by-side on your computer. Kind of. Let’s dig into that a little deeper and see what can be found on my machine.
If I go to: C:\Windows\Microsoft.NET\Framework I will see the following:
That might immediately make you wonder, why isn’t 4.6.1 there? Well, actually, it is – it is within the 4.0.30319 folder. Any version 4 of the framework is going to end up there and replace any version currently installed, which might seem a little confusing.
That begs the next question: why are there two folders for version 1 and two for version 3 – doesn’t that follow the same rule? Err, no, because Microsoft considered these major releases so changed the rules.
OK, then, what if I want to target version 4.5.whatever of the .NET framework – if it was replaced by version 4.6.1, how can I still use it? The key thing to understand here is that Microsoft makes all new versions backwards compatible with previous versions of the same major version. So, all 4.X.Y which are lower than 4.6.1 in my case, can be targeted.
It’s a pretty interesting topic and you can to see a list of the prior versions here.
Written by Stephen Moon
email: stephen at logicalmoon.com