views:

110

answers:

1

There are a bunch of new APIs in .Net 3.5 SP1.

Short of uninstalling .Net 3.5 SP1 (or doing dev on a VM), is there a way I can get VS 2008 to target .Net 3.5(RC) as opposed to .Net 3.5 SP1?

Is there a way I can get it to issue a warning when there is an API not supported in 3.5 SP1 which is being invoked?

Similar question: http://stackoverflow.com/questions/640057/find-code-that-depends-on-net-3-5-sp1

+3  A: 

This actually has a surprisingly tricky answer.

First of all, to get this functionality that is outline in the following post you will need either the latest version of fxcop or VS 2008 SP1.

Once you have that installed there is a new rule (in VS 2008 Team System) called Portability Rules -> Use only API from targeted framework.

But that is not enough

Fxcop is currently shipping with dodgy wpf rules:

Quote from the last line in the above post:

It seems like there are bugs in this because it didn't complain when I referenced IEditableCollectionView which was added in 3.5 SP1. As a matter of fact, it seems like "C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\Repository\Compatibility\Desktop3.5SP1.xml" doesn't list ANY of the new WPF assembly members.

Andrew, thanks for the feedback. You are correct, there is a bug. The data for WPF 3.5 SP1 is included, it's just listed under 3.0 SP2. However, the 'Priority' attribute for this file and 2.0 SP2 is incorrect. I've forwarded this information on to my old team, in meantime, a workaround is to manually change these files; for Desktop3.0SP2.xml change the priority from '3020' to '3520' and for Desktop2.0SP2.xml change the priority from '3015' to '3515'.

So you will need to crack open cmd in admin and fix up those files if you want this to work.

Once that is done, it seems to work fine.

Sam Saffron