Multi-Targeting FxCop Rules

  • 1 minute to read
  • edit

Last month, I talked about multi-targeting, one of the new features in Visual Studio 2008. According to Krzysztof, the idea of Red and Green bits made this possible. Everything sounds good, so far. However, there is a very limited number of APIs that have been added to the Red bits that the multi-targeting system isn’t able to detect. What this means is that if you set the target to the .NET Framework 2.0 and use one of these new changes, the compiler will not issue a warning or an error. The application will compile just fine, but will fail at runtime.

In order to help deal with this issue, Krzysztof has written a custom FxCop rule that can analyze an assembly targets at the .NET Framework 2.0 and warn you about calls to members that aren’t present in the 2.0 RTM. This is a sample project, and is provided without any guarantees. Hopefully, it will get some more polish and make it’s way into either the VS2008 RTM release or an update to FxCop. To install the rule, build the sample project and copy the rules to the FxCop directory.

Comments