开发者

Detecting .NET Framework service pack specific functions

I recently ran into an issue where I used a property that was introduced in the .NET Framework 2.0 SP1. This caused the code to fail completely on a pre-SP1 machine. Now I'm starting to wonder if there are any other hidden bugs like this waiting to pop-up. Is there a tool, or any way to scan an assembly and see if there are any methods/fields/properties/whatever that are dependent on a framework service pack? Maybe something like FxCop or Reflector could do this, but I'm not sure how to do this. Any help would be much appreciated.

Just for reference, the property that was introduced in 2.0 SP1 that I tried to use was开发者_如何学JAVA the Font.OriginalName property.


I'd recommend looking into FxCop for this. Krzysztof Cwalina at Microsoft wrote some rules that should help you. Scott Hanselman also has a list of changes from 2.0.50727.42 to 2.0.50727.1378 (which is where you'll see your OriginalFontName property).

As a side note, according to Microsoft's documentation for OriginalFontName

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.


While you could depend on a written list, the only definitive way to do this would be to have the old and the new type, and do a search across the set of members on each type in each version.

Of course, it's very possible that the change lists that MS puts out in its documentation are generated in this way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜