I would like to turn of and on the ules directly in project file of Website. But i could not locate the file. We have option to set the rules in .cs (project file ) of windows applications. But as per ur posting, in website all the rules will be saved in user file for website. Pease let me know ehere can i find the user file so that i can distribute the file among my team and they can have common analysis tools

Re: Visual Studio Code Analysis and Code Metrics How do I modify Code Analysis settings for Web Projects?


I believe in a website project, the rules you pick get referenced somewhere in the solution's .suo file (user options). You don't want to check in this file or distribute it to team members. But there is a better option - you can use Web Application Projects (available as an add-in, but included with SP1 for VS2005). In this model the code analysis rules would get stored in the .csproj file, just like other VS projects.

There's a very good article on MSDN introducing Web Application Projects and contrasting them with Web Sites:

I would recommend using Web Application Projects instead of Web Sites for enterprise web applications. If you really can't use Web Application Projects for some reason, you have to have a way to synch up the rulesets between different developers machines. I don't think sharing or checking-in the .suo file seems like a good idea even if it would work (not sure it would). But you could share rulesets via Visual Studio automation (a macro or add-in) that would allow developers to import the ruleset you define.

Furthermore, if you have TFS, you can define a code analysis policy for a Team project, then "Migrate Code Analysis Policy Settings to Solution" by right clicking on the Solution node in your solution and picking that menu item. This is a one time import, and only the union of the Policy and your local settings (it will not disable anything that you already have checked locally, and since all rules are checked by default, you have to first uncheck all of the rules in each project to make this a useful option).

Summary: I recommend Web Application Projects over Web Sites if you want to share code analysis settings with your team.