locked
c++ cli static code analysis RRS feed

  • Question

  • Hi.
    I have a solution with both c# projects and C++\CLI projects.
    I've declared static code analysis check in policy rule in my team project.
    Is there a way to enforce the code analysis only for the C# projects?

    Thanks,
    Sagie
    Sunday, November 29, 2009 4:33 PM

Answers

  • Ok, I've got the answer. And it is quit simple:

    I just use the Custom Path Policy, to enforce code analysis only when a *.cs or *.csproj are checked in.

    Thanks!
    • Marked as answer by liurong luo Monday, November 30, 2009 10:32 AM
    Monday, November 30, 2009 9:57 AM

All replies

  • Hello Sagie,

    Based on my understanding, we have a set of code analysis rules for our team, and we want to share those rules with multiple C# projects, please correct me if I misunderstand something.
    In case that I'm right, to enable managed code analysis rules with multiple MSBuild projects in our team, please open the project file (either .csproj) and add the follow to the <CodeAnalysisRules> section:

     <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">                        
       <
    PropertyGroup>
          <
    CodeAnalysisRules>$(CodeAnalysisRules);[rulesettings]</CodeAnalysisRules
       </
    PropertyGroup>
     </
    Project>

    For the detailed steps, please refer to David's blog: How do I share Managed Code Analysis rule settings over multiple projects?
    Please let me know if this helps,


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Monday, November 30, 2009 3:32 AM
  • Hi.
    In this way you don't enforce code analysis via check-in policy.
    I have a large team, and I want to be sure that every changeset passed our code analysis rules.
    In this way, the check-in policy will activate the code analysis on my C++\CLI as well. I am looking for a way to disable this option.
    Does anybody know if this is possible?

    Thanks,
    Sagie

    Monday, November 30, 2009 6:54 AM
  • Ok, I've got the answer. And it is quit simple:

    I just use the Custom Path Policy, to enforce code analysis only when a *.cs or *.csproj are checked in.

    Thanks!
    • Marked as answer by liurong luo Monday, November 30, 2009 10:32 AM
    Monday, November 30, 2009 9:57 AM