Run Code Analysis returns different restuls in Ultimate\Premium Editions

Locked Run Code Analysis returns different restuls in Ultimate\Premium Editions

  • Thursday, August 09, 2012 7:35 AM
     
      Has Code

    Hello,

    We started to use Code Analysis option in our solution.

    We created new Ruleset and enabled it in all our projects.

    When I run CA from my station with VS 2010 Ultimate I get some CA warnings, few of them are CA1704 (Microsoft.Naming).

    BUT when I run CA in another station that contains VS 2010 Premium, I get different results and it does not contain CA1704...

    I checked it on 4 PCs with VS Premium installed and all of them displays wrong results than VS Ultimate.

    To summerize, VS2010 Premium edition display different results than VS2010 Ultimate ...

    Is this normal?

    I got the code analysis command from VS output window, the command is the same in all VS editions:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe  
      /outputCulture:1033 
      /out:"..\..\..\..\..\..\Binaries\<X>\dll.dll.CodeAnalysisLog.xml" 
      /file:"..\..\..\..\..\..\Binaries\<X>\dll.dll" 
      /dictionary:"..\..\..\..\SDCADictionary.xml" 
      /reference:"c:\Dev\<X>\<Y>\Binaries\<X>\another1.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.CSharp.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\PresentationCore.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\PresentationFramework.dll" 
      /reference:"c:\Dev\<X>\<Y>\Binaries\<X>\another2.dll" 
      /reference:"c:\Dev\<X>\<Y>\Binaries\<X>\another3.dll" 
      /reference:"c:\Dev\<X>\<Y>\Binaries\<X>\another4.dll" 
      /reference:"c:\Dev\<X>\<Y>\Binaries\<X>\another5.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.DataSetExtensions.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xaml.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" 
      /reference:"c:\Dev\<X>\<Y>\Binaries\3rdPartyLibs\another6.dll" 
      /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\WindowsBase.dll" 
      /directory:"c:\Dev\<X>\<Y>\Binaries\3rdPartyLibs\<Z>" 
      /directory:"c:\Dev\<X>\<Y>\Binaries\<X>\<W>" 
      /directory:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" 
      /directory:"c:\Dev\<X>\<Y>\Binaries\<X>" 
      /ruleSet:"=c:\Dev\<X>\<Y>\Source\<X>\<....>\..\..\..\..\SD.ruleset"
      /rulesetdirectory:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets"
      /rule:"-C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules" 
      /searchgac /ignoreinvalidtargets /forceoutput /successfile /ignoregeneratedcode /saveMessagesToReport:Active /timeout:120 

    Please help, I so frustrated...

    Thanks,

    Roy


    R.R


All Replies

  • Thursday, August 09, 2012 3:19 PM
     
     

    I wouldn't expect any differences.

    One option is that there is a CustomDictionary.XML file in the application data folder of the Visual Studio Ultimate machine causing the results to change. See:

    http://msdn.microsoft.com/en-us/library/bb264492.aspx

    Or your FxCop directory might contain a different *.lex file which contains the spelling definitions. The lex file can be found here by default:

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop

    Just curious, what differences are you seeing?


    My blog: blog.jessehouwing.nl

  • Friday, August 10, 2012 9:39 AM
     
     

    Jesse,

    Thanks for replying.

    I also thought that, but it's not the case.

    All the projects inside the solution contain a link to the same custom dictionary.

    Moreover, CA1704 is not the only warning I should get, other warnings such as CA1001, CA1063 etc. also weren't displayed.

    I also have Team Build server with VS Premium installed and still don't get all the warnigns that displayed in VS Ultimate

    Roy


    R.R

  • Monday, August 13, 2012 6:24 AM
    Moderator
     
     

    Thanks for Jesse’s help.

    Hi Roy,

    So the issue is that the same app in different VS versions has different warnings, am I right?

    I couldn’t repro it since I didn’t have the VS Premium Environment now, but just to make it clearly, whether it has the same result when you use all the VS Premium versions?

    If possible, you could share us a simple sample, we try to check it in VS Ultimate and VS2012 RC, Please attach your Visual Studio project, you can upload it to the sky driver, and then share the download link in your post. Please also attach a screenshot image about the result in the VS2010 Ultimate in your post.

    If there's any concern, please feel free to let us know.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

  • Tuesday, August 14, 2012 6:30 AM
     
     

    Jack,

    Thank you. I'll try to reproduce it.

    In my solution(with ~100 projects), I use custom ruleset and custom dictionary.

    The different between the results is ~30 CA warnings and all of them are in a specific project. I tryied comparing the settings of this project and another one - no difference.

    Most warnings related to naming (I though I had problem with the custom dictionary) but I also has design warnings such as CA1001  

    Roy


    R.R

  • Wednesday, August 15, 2012 4:26 AM
    Moderator
     
     Answered

    Hi Roy,

    What about this problem now?

    If just the specific project has this issue, maybe you could try to check it separately in different VS versions.

    Most warnings related to naming (I though I had problem with the custom dictionary) but I also has design warnings such as CA1001

    Maybe you could try to change them to the default folder and check it. The easiest way to integrate your rules into Visual Studio 2010 is to copy them to the %Program Files%\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\Rules directory.

    Reference:

    How to write custom static code analysis rules and integrate them into Visual Studio 2010

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us