BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News FxCop Rule for Multi-Targeting

FxCop Rule for Multi-Targeting

This item in japanese

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
Style

BT