Using Older Frameworks with Multi-Targeting

Tips Search

If you like the tips then you'll love the book!

Order your copy today:
http://www.amazon.com/gp/product/0735649928

Using Older Frameworks with Multi-Targeting

  • Comments 1

Versions:  2008,2010
Published:  3/23/2010
Code:  vstipProj0005

 

Do people make fun of your out-of-date IDE?  Do you have to sit alone in the cafeteria because you use an older Framework?  Well don't worry!  We can make you cool again.  Even if you use an older version of the Framework you can still use all the great features in VS2008 and VS2010 through Multi-Targeting. 

 

When you go to create a new project, locate the dropdown list of supported Frameworks and simply choose the one you prefer.  You get to use all (or most) of the great features in the new IDE but still keep your older version of the Framework.  Here is a screenshot from the VS2010 New Project dialog:

image

  • It looks like Visual Studio is still using the new compiler even when you target an older version of the framework.

    For example:

    static string Test(int i) { return i.ToString(); }

    ...

    Enumerable.Range(1, 10).Select(Test)....

    In VS2008, this gives a compiler error:

    The type arguments for method ... cannot be inferred from the usage. Try specifying the type arguments explicitly.

    In VS2010 targeting v3.5, this compiles and works.

    This isn't an issue for most code, but it could cause problems anything that relies on run-time compilation - eg: ASP.NET sites.

Page 1 of 1 (1 items)
Leave a Comment
  • Please add 7 and 7 and type the answer here:
  • Post