C++ and .NET Framework Multitargeting

I'm not going to write a long note explaining once again that I've been too busy to post. We all know it's not true and who wants to sound like a hypocrite right?

In any case, my colleague Luke recently posted an entry about a feature we both worked on and I wanted to share the cool news as a foray into talking about Visual Studio 2008 (and perhaps more!). We dubbed the feature ".NET Framework Multitargeting" and it does indeed sound like a mouthful. I'm not going to describe it in gory detail since Luke already did a great job of this, but I will clarify a couple of points.

The first and most important thing is to understand what the feature is (and what it isn't). The goal of multitargeting is to make it easier to build applications and components such that they will run on one of the 3 frameworks based on CLR 2.0:

  • .NET Framework 2.0 - the one we released with VS2005
  • .NET Framework 3.0 - the one we released with Vista
  • .NET Framework 3.5 - the one we are releasing with VS2008

Notice that I said all 3 of these run on CLR 2.0, which means that all of these work with the same runtime. We are not performing runtime multitargeting (although this was oft-requested in the 1.1->2.0 migration) as it involves significantly more complexity but we do want to tackle this in the future as we upgrade the runtime.

So what does multitargeting enable if not the ability to switch runtimes? It helps you understand which assemblies are available in which framework in order to facilitate building and deploying applications for a specific minimum framework version. Over time, with the advent of Silverlight and the next version of the CLR, I hope we will extend this notion into a complete and general solution that enables developers to use the latest development tool with the deployment target of their choice.

As for you, the C++ developer,there are a couple of points in the UI that Luke does not mention since the project system for VC++ is not the same as C# and VB. In order to choose your preferred framework target for a C++ project, you go to the project properties pages, under the "Common Properties" section as shown in this screenshot.

c multitargeting 1

As you might remember, this property page is not per-configuration so you can't use this facility to create a set of configurations for each deployment target for your application. I would have liked to do this, but first we wanted to keep it simple, second, the idea of building an app for multiple different minimum deployment framework targets seemed rare.

Anyway, I hope you enjoy this feature, and please give us your feedback as you can play with this in VS2008 Beta 2.