Code Analysis Policy Problem

I added "Code Analysis" policy type in to check-in policy and removed some rule from Code Analysis Policy Editor. Then I open my solution and click "Migrate Code Analysis Policy Settings to Solution". I saw all rule is enabled in Code Analysis of Project. I don't understand why "Migrate Code Analysis Policy Settings to Solution" does not remove some rule in project


Answer this question

Code Analysis Policy Problem

  • MasterBrain007

    No body can help me I want to know this is a bug or by design.

  • Dave12349

    Is there any progress on this tool
  • Thomas D. Greer

    I very disappointed of this design . If I have more than 50 projects to migrate TS and enabled code analysis in check-in policy. I need manually to setup it 50 times .



  • jdavidw13

    How about automating the creation of a code analysis check-in policy with a given set of rules. Or automatically adding a given set of rules to a new project.

    Our company does not use a complete set of rules. We decided to adapt about half of them on start and develop one. Right now I do not know how to set up a template that contains our set of rules and use it in newly created projects. i do not want to do it for every team project from the beginning. It is error prone.

    It was easy to do with FxCop where we created a file with our set of rules and made a copy for every new project.

    Is it be possible Will it be


  • pangwa

    Eagle Tsui wrote:
    No body can help me I want to know this is a bug or by design.

    I think it's by design, but I'm not a big fan of this design. The Migrate function will only turn on rules in your project, it will never turn rules off. I think it is done this way in case you want to have extra rules turned on in your project that aren't part of the policy...so the migrate won't keep turning them off.


  • DTMartin

    This is in fact by design, but we should also have supported the gesture that you're requesting. We are looking in to developing a power tool that can help automate copying the code analysis policy to all projects in a solution. The fastest way to do this today from the IDE is to disable all rules in each project before migrating the policy. It is possible to script the rule disabling and that's how we are thinking of addressing the issue with a standalone tool. I will use this feedback as ammunition to drive getting the tool written and delivered as soon as we can!

    Let me explain the motivation for the current behavior. We wanted to support holding sub-projects to a higher code analysis bar than the team policy. In those cases, we did not want the migration gesture to blow away any decisions that might have been made about particular sub-projects. However, we could have (and should have!) supported both migration gestures:

    1) *merge* policy with project: turn on or change warning to error for any rules which are enabled or treated as errors in the policy, but not in the local project. (i.e. how it works today.)

    2) *copy* policy to project: overwrite local settings with policy settings. (i.e. what you're requesting.)

    Our plan is to support both gestures in the next Visual Studio release, and hopefully we can get most of the way there by providing a tool to help automate the second gesture in VS 2005.

    Thank you for your feedback!

    Nick


  • Ink Sloth

    This is not currently possible in 2005 or 2008 (although at least in 2008 you have the merge or copy options).

    The scenario of being able to save off the set of rules and re-use in policy is a good one and something we are considering for the next release of Visual Studio Team System (Codename Rosario). Watch out for the next CTP of Rosario. You will see the beginnings of a feature along these lines. I will post more when it becomes available.


  • Code Analysis Policy Problem