On the forums, we have had posts from customers who want to customize their code analysis policy to skip certain file types such as .sql, docs etc. This is because the policy will block checkins even though code analysis doesn’t apply to those files.[ See thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1080300&SiteID=1 ] There is now a way to configure code analysis policy to apply to specific source control paths/file types. Check out the tool on gotdotnet that helps you to do so. http://www.gotdotnet.com/codegallery/codegallery.aspx?id=96d7da50-0d61-4230-9af9-49684ae9881e
Here's what you need to do (Part of the steps are also in the readme for the custom path policy)
a) Download the custom code analysis policy from the location specified on the link. This is a project and you will need to build it.
b) Launch Regedit (or any other registry editor of choice), and navigate to the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\TeamFoundation\SourceControl\Checkin Policies
c) Add a string value called "CustomPathPolicy" – set the value to the path where the DLL is located, such as: C:\SD_TIDM\Technical Integration\CustomPathPolicy\Extensibility\bin\Debug\CustomPathPolicy.dll
Once the registry key is set up, follow these steps to set up the custom policy.
Once you have this set up, the code analysis policy will apply to only paths that you have specified. One thing to keep in mind is that migrating code analysis settings to solution does not respect the paths set in the custom path policy. i.e. Migrating code analysis policy settings to solution will migrate to all projects within the solution, not just the ones specified in the custom path policy.