Amazon.com Widgets

VS2008 Multitargeting Gets Even Better with SP1

One of my favorite features of VS2008 is the ability to target older versions of the .NET Framework.  This allows developers to use the latest and greatest tools even if some client machines can't be upgraded to the latest version of framework right away.

While there is really good support for this in VS2008 for example, VS 2008 is smart enough to keep you from adding a reference to assemblies that are not found in the target version of the framework (for example, you can't use WPF if your target framework is .NET Framework 2.0).    But what about the case when new methods are added to existing classes or new classes in existing assemblies?  For example the DateTimeOffset?  

For those we added a new FxCop rule in VS2008SP1... I highly recommend you use this if you are cross targeting.

David Kean has the full play by play, but basically you enable the rule in VS

image

And select your target framework

image

Then if you use some new types of members, you get this warning.

'Use only API from targeted Framework' warning

Of course this works for the standard alone version of FxCop as well.

Check out David's blog for all the details!

Published 02 September 08 09:53 by BradA
Filed under:

Comments

# car insurance » VS2008 Multitargeting Gets Even Better with SP1 said on September 2, 2008 1:02 PM:

PingBack from http://hoursfunnywallpaper.cn/?p=4227

# Willie Roberts said on September 2, 2008 2:16 PM:

Awesome info. Just one small comment, maybe mention that it will only apply to VSTFS however I do wish there was a way to plug FxCop into Professional, similar to the way StyleCop does.

# Eddie Velasquez said on September 2, 2008 5:44 PM:

I guess you meant DateTimeOffset, not DateTimeOffsite.

# Rod Mac said on September 2, 2008 8:40 PM:

Great stuff. Am just going to keep nagging MS and say SL should come in 2 flavours - one for Windows machines & one for crossbrowser everything else. And guess what, the Windows version is a true subset of .NET and hence would be an even lighter client .NET distributable, the stuff that XBAPs would really have been made of with a lot of hindsight - no criticism intended here, the initial hoop had to be iterated. Of course multitargeting would control the SL boundary for Windows boxes, and a recompilation would create a 2nd build for non windows SL deployment.

# Visual Studio Hacks said on September 7, 2008 11:03 AM:

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. Sara Ford's Tip of the Day #305 shows how to reevaluate expressions in the QuickWatch window . Brad Abrams explains how VS208 Multitargeting

# Joycode@Ab110.com said on September 12, 2008 5:45 AM:

【原文地址】 VS2008 Multitargeting Gets Even Better with SP1 【原文发表日期】 02 September 08 09:53 我在VS2008中最喜爱的特性之一

# Под пристальным взглядом... Трухина Юрия said on October 13, 2008 3:53 PM:

Одной из моих любимых особенностей VS2008 является возможность использования старших версий .NET framework....

New Comments to this post are disabled

Search

This Blog

Syndication

Page view tracker