Thursday, January 6, 2011

C# Snippets - Get CLR Version Info

While having a chit chat with my friend, our discussion got on with, the different versions of C# and CLR and how do they stack up. For me its was something new to hear that the CLR version 3 actually didn't exist at all, instead Microsoft had released service packs for CLR, to contain the changes that came in .NET Framework v3.0 and above. Here is a list of C# and CLR version mapping details which I had collected from other sources.


Framework  CLR and Assemblies            Release
----------------------------------------------------------
1.0 RTM    1.0.3705.0                    Visual Studio .NET (aka VS.NET 2002)
1.0 SP1    1.0.3705.209
1.0 SP2    1.0.3705.288
1.0 SP3    1.0.3705.6018

1.1 RTM    1.1.4322.573                  VS.NET 2003
1.1 SP1    1.1.4322.2032
1.1 SP1    1.1.4322.2300                 Windows Server 2003

2.0 RTM    2.0.50727.42                  VS2005 RTM
2.0 RTM    2.0.50727.312                 Windows Vista
2.0 SP1    2.0.50727.1433                VS2008 RTM and .Net 3.5 RTM
2.0 SP2    2.0.50727.3053                VS2008 SP1 and .Net 3.5 SP1
2.0 SP2    2.0.50727.4016                Windows Vista SP2 and Windows Server 2008 SP2
2.0 SP2    2.0.50727.4927                Windows 7

Framework  CLR           New assemblies
----------------------------------------------------------
3.0 RTM    2.0 RTM       3.0.4506.30     The only "out-of-band" non-SP framework release
3.0 SP1    2.0 SP1       3.0.4506.648    VS2008 RTM and .Net 3.5 RTM
3.0 SP2    2.0 SP2       3.0.4506.2123   VS2008 SP1 and .Net 3.5 SP1

3.5 RTM    2.0 SP1       3.5.21022.8     VS2008 RTM and .Net 3.5 RTM
3.5 SP1    2.0 SP2       3.5.30729.01    VS2008 SP1 and .Net 3.5 SP1
3.5 SP1    2.0 SP2       3.5.30729.4926  Windows 7

Framework  CLR and Assemblies            Release
----------------------------------------------------------
4.0 RTM    4.0.30319.1                   VS2010


If you are interested to know the CLR version which your application is running on, use the following C# snippet to get hold of the CLR version information.


Console.WriteLine(typeof(object).Assembly.ImageRuntimeVersion);

No comments: