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
And select your target framework
Then if you use some new types of members, you get this warning.
Of course this works for the standard alone version of FxCop as well.
Check out David’s blog for all the details!