Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Joydip Kanjilal

Dr. Dobb's Bloggers

Enhanced Multi-targeting Support in Visual Studio 2010

May 10, 2010

Multi-targeting is a Visual Studio 2010 feature that lets you create applications targeting earlier versions of the .NET Framework.

According to Scott Guthrie:

VS 2010's multi-targeting support enables you to work on projects that target .NET 4.0, .NET 3.5, .NET 3.0 and .NET 2.0. It will allow you to start taking advantage of the new tooling features, without having to immediately upgrade the clients and servers running your application's to .NET 4.0. The improved multi-targeting support will ensure that this experience is even better and more accurate than before.

The Visual Studio 2010 IDE provides support for creating applications targeting at any one of the following versions of .NET Framework:

  • .NET Framework 4.0
  • .NET Framework 3.5
  • .NET Framework 3.0
  • .NET Framework 2.0

So, you can create and edit projects targeted at any one of the versions of .NET Framework stated above and you can now have all versions of .NET Framework reside side-by-side in your system.

Support for multi-targeting was also available in Visual Studio 2008. However, Visual Studio 2010 provides an enhanced support for multi-targeting. The ToolBox in Visual Studio 2010 IDE now displays only the controls that are part of the version of .NET Framework your application is targeted at. Also, Intellisense within the Visual Studio 2008 IDE used to display types and members of .NET Framework 3.5 even though your application was targeted at a different version of the .NET Framework. With Visual Studio 2010, you have Intellisense within the Visual Studio 2010 IDE display types and members that are only specific to the particular version of .NET Framework your application is targeted at. So, if your application is targeted at .NET Framework 2.0, you would notice Intellisense display only those types and members that are part of .NET Framework 2.0. You can find out more about multi-targeting support in Visual Studio 2010 here

For projects targeted at .NET Framework 4.0 or later, the application's web.config file contains the targetFramework attribute. Here's an example:

    <compilation debug="false" 

Note that when you upgrade your project to .NET Framework 4.0 using Visual Studio 2010 IDE, the targetFramework attribute is automatically inserted in the application's web.config file. Also, this attribute is automatically removed from the application's web.config file when you switch to an earlier version of the .NET Framework. You can find out more on how to use multi-targeting for your ASP.NET projects here.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.