BT

FxCop Rule for Multi-Targeting

| by Jonathan Allen Follow 612 Followers on Oct 09, 2007. Estimated reading time: less than one minute |

Multi-targeting in Visual Studio 2008 leads to a new set of problems. With .NET 3.5 bringing new features to the core assemblies, care must be taken when targeting .NET 2.0. Otherwise, an application can be compiled successfully but fail to run due to missing methods. One way to handle this is to use Krzysztof Cwalina's Multitargeting rule for FxCop.

FxCop, which provides code analysis for Visual Studio, allows developers to create the own custom rules. FxCop rules work against IL, not source code, so they are automatically available for any compiled .NET language.

Krzysztof has provided a sample rule that issues warnings whenever a new class or method is used. The list of new classes and methods is provided along with the source code. This rule could also be adapted to discourage the use of other classes deemed inappropriate for the project. One possibility is to get a list of Mono classes not yet implemented and filter against them.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT