0

I have only visual studio 2010 in my machine. But, when I look at the visual studio command prompt for "clrver", it shows two versions of CLR are installed in my machine - v2.0.5 and v4.0.3

From this link, I understand only the CLR version v4.0.3 should be available in my machine. http://msdn.microsoft.com/en-us/library/bb822049.aspx

But I am confused how I got v2.0.5. please explain?

Deepak Raj
  • 730
  • 2
  • 9
  • 26

2 Answers2

3

Visual Studio 2010 lets you write applications that target multiple versions of the NET Framework (2.0, 3.0, 3.5, and 4.0).

You'll notice from the article you linked to, that .NET Framework versions 2.0, 3.0, and 3.5 all share the same CLR version: 2.0, whereas 4.0 uses a new version 4.0 of the CLR.

So in order for VS2010 to allow you to work on 2.0-3.5 projects it needs to install the 2.0 CLR. That's why it's installed.

Dai
  • 141,631
  • 28
  • 261
  • 374
  • Doesn't CLR v4.0.3 supports backward compatibility for .net framework 2.0,3.5 and 4.0 or we need separate CLR v2.0 for those? – Akash KC Mar 20 '13 at 04:45
  • 1
    There is limited backwards-compatibility, however unlike Java, Microsoft has not committed to backwards-compatibility because of the need to change behaviour and deprecate and remove obsolete elements. Granted, most programs that target 2.0 will work on 4.0, but this not guaranteed. – Dai Mar 20 '13 at 04:48
0

Simply speaking, when clrver tells that

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>clrver

Microsoft (R) .NET CLR Version Tool  Version 4.0.30319.17929
Copyright (c) Microsoft Corporation.  All rights reserved.

Versions installed on the machine:
v2.0.50727
v4.0.30319

It actually means

  • You have .NET 2/3/3.5 installed on this machine
  • You have .NET 4 or 4.5 installed on this machine

The output is only related to the .NET Frameworks installed on your machine, and does not depend on which version of Visual Studio you use.

CLR v2.0.50727 is shared by .NET 2.0/3.0/3.5, while CLR v4.0.30319 is shared by .NET 4.0 and 4.5. Please try to treat .NET Framework and CLR as separate concepts. I know it is hard for beginners to distinguise them from each other.

Note that it is v2.0.50727, not 2.0.5 mate, as 2.0.50727 is an atomic concept. This also applies to v4.030319.

Your intepretation of the MSDN article is incorrect. To avoid further misunderstanding, you might read more about CLR from books such as CLR via C# and so on.

Lex Li
  • 60,503
  • 9
  • 116
  • 147