-1

I am trying to find the .NET runtime version of an assembly. I have looked at the two top answers of the: Determine framework (CLR) version of assembly but they do not seem to report the correct version.

I am building the assembly on a machine running .NET 4.6.1 and in Visual Studio the project is targeting .NET 4.5.1 however when I look at the assembly using the answers on the other question I get:

v4.0.30319

Instead of something along the lines of

v4.5.1.*****

What is going on?

Community
  • 1
  • 1
MaYaN
  • 6,683
  • 12
  • 57
  • 109
  • Did you read this answer on that very same question you linked that exactly addresses your question? http://stackoverflow.com/a/18623516/1141432 – itsme86 Jun 20 '16 at 15:40
  • Yes I did, but I needed to know why which @Kaspars Ozlos just answered and as explained there, the method does not work for assemblies < 4. – MaYaN Jun 20 '16 at 15:44

1 Answers1

4

Take a look at official Microsoft blog instead:

https://blogs.msdn.microsoft.com/rodneyviana/2014/12/23/identifying-the-net-version-you-are-running-2-0-4-5-4-5-1-or-4-5-2/

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.

Apparently, the only way how to tell the difference is by looking at build number of clr.dll.

build number map to versions

Kaspars Ozols
  • 6,967
  • 1
  • 20
  • 33