Visual Studio 2008 has a new feature called Multi-Targeting which allows developers to create applications that use different versions of .NET Framework using the same IDE. This feature has caused quite a bit of confusion among developers. Let me explain what the reason is for this confusion. Up until .NET Framework 2.0 the version of the framework was synonymous to the version of CLR. In fact there was no distinction between the two. Meaning if you were developing for .NET Framework 1.0, then you are targeting CLR 1.0. The same is true for versions 1.1 and 2.0. Starting with version 3.0, Microsoft broke the relationship between the .NET FX version and the CLR version. To put it simply, Microsoft is now considering .NET FX and CLR as two separate entities. Version 3.0 of .NET FX contains new libraries that support new technologies such as WPF, WCF and WF. However, these features were built on top of the existing .NET FX 2.0. However, no changes where made to the CLR, which still remains version 2.0. In reality, the FX 3.0 is actually .NET FX/CLR 2.0 + new libraries. Why Microsoft branded the new set of libraries as a new .NET FX version is beyond me. The marketing groks at Microsoft apparently felt it was the right thing to do. Additionally, the .NET FX 3.5 takes this idiosyncrasy to the next level. The .NET FX 3.5 contains new features such as LINQ as well as some enhancements to the C# language. The C# language gets the new version 3.0. The new features of C# language such as Object Initializers, Collection Initializers, Anonymous types, Implicit Type Inference, and Automatic Properties are compiler features and require no additional supporting libraries. However, lambda expressions and LINQ which are also considered C# language features, do need supporting libraries which are part of .NET FX 3.5. The CLR version for .NET Framework 3.5 is still 2.o. The end result being, .NET FX 3.5 = .NET FX/CLR 2.0 + FX 3.0 (WPF, WCF, WF) + C# 3.0 and LINQ. The relationship between the various versions of .NET Framework, CLR, and Visual Studio is nicely explained by David Broman in his post, so I won’t repeat it here. Though, I would like to make one point clear and that is whether you are using .NET FX 2.0, 3.0, or 3.5, you are still targeting the CLR version 2.0. In an interview in the February 2008 issue of DDJ, Microsoft Vice President of Developer Division S. Somasegar mentions that one of the biggest feature requests that Microsoft received from its customers was the ability to target the older version of .NET Framework using the newer version of Visual Studio. He goes on to mention that using VS2008 you can build applications targeting .NET FX 2.0, 3.0, and 3.5. While this is true, Microsoft is missing the point. While Visual Studio 2005 was in beta (and even after its release), when customers asked for the feature for targeting the older version of the framework, they actually meant CLR 1.0, 1.1, and 2.0. What customers were asking for and what they actually received in VS2008 are two different things. The VS2008 Multi-Targeting feature is quite misleading IMHO. Whether you are using FX 2.0, 3.0, or 3.5, you are still using CLR 2.0. What multi-targeting really does is just provide an easy way to reference different sets of libraries while still using the same old CLR. Since Microsoft changed the meaning of the .NET Framework version and made the distinction between CLR version and the Framework version, I guess they are correct when they say VS2008 supports multiple .NET FX. However, Microsoft also has changed the meaning of the request that the customers originally made and supplied something quite different. Additionally, they created quite a bit of confusion.
Note: I understand and I am not denying that .NET FX 3.5 is much more than C# 3.0 and LINQ. I am specifically discussing the VS2008 feature, its relationship with FX and CLR version, and the confusion that it has caused.
{ 1 } Comments