Code analysis rules that are used by the policy could not be loaded
-
Wednesday, June 27, 2012 2:58 PM
Then I tried check-in files on server, i got strange Policy warning:
" One or more Code Analysis rules that are listed below could not be loaded. To pass the code analysis policy for this team project, all policy rules must be run on project with no vialations
BasicCorrectnessRules.ruleset
below list of rules, such as ca1001, ca1008"
In project properties, which files I want to check in, enabled code analysis on build option and selected Microsoft Basic Correctness Rules.
Few days ago however, all works perfect.
thanks.
All Replies
-
Friday, June 29, 2012 5:18 AMModerator
Hi rork,
Thank you for posting in the MSDN forum.
"One or more Code Analysis rules that are listed below could not be loaded. To pass the code analysis policy for this team project, all policy rules must be run on project with no vialations BasicCorrectnessRules.ruleset below list of rules, such as ca1001, ca1008”
It seems that you are using the TFS, am I right?
Not the TFS expert, but based on the error message, it seems that it violations the Basic Correctness Rules.
I did some research about this issue, the Microsoft Basic Correctness Rules rule set focuses on logic errors and common mistakes in the usage of framework APIs. You should check the ca1008 and others.
For detailed information, see “Microsoft Basic Correctness Rules Code Analysis Rule Set”, hope it could help.
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
-
Friday, June 29, 2012 7:28 AM
Hi Jack,
thank you for reply
The list with rules contains more than 50 messages, such as
"Visual Studio did not find rule CA####. This rule is required by the Code Analysis policy for this Team Project. Check in items using a version of Visual Studio that has this rule."
Project to check-in does not contain warnings or messages. In properties set path to ruleset file - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\Rule Sets\BasicCorrectnessRules.ruleset. I check file and here is its contains (maнbe problem is that file incorrect):
<?xml version="1.0" encoding="utf-8"?> <RuleSet Name="Microsoft Basic Correctness Rules" Description="These rules focus on logic errors and common mistakes made in the usage of framework APIs. Include this rule set to expand on the list of warnings reported by the minimum recommended rules." ToolsVersion="10.0"> <Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized"> <Name Resource="BasicCorrectnessRules_Name" /> <Description Resource="BasicCorrectnessRules_Description" /> </Localization> <Include Path="minimumrecommendedrules.ruleset" Action="Default" /> <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed"> <Rule Id="CA1008" Action="Warning" /> <Rule Id="CA1013" Action="Warning" /> <Rule Id="CA1303" Action="Warning" /> <Rule Id="CA1308" Action="Warning" /> <Rule Id="CA1806" Action="Warning" /> <Rule Id="CA1816" Action="Warning" /> <Rule Id="CA1819" Action="Warning" /> <Rule Id="CA1820" Action="Warning" /> <Rule Id="CA1903" Action="Warning" /> <Rule Id="CA2004" Action="Warning" /> <Rule Id="CA2006" Action="Warning" /> <Rule Id="CA2102" Action="Warning" /> <Rule Id="CA2104" Action="Warning" /> <Rule Id="CA2105" Action="Warning" /> <Rule Id="CA2106" Action="Warning" /> <Rule Id="CA2115" Action="Warning" /> <Rule Id="CA2119" Action="Warning" /> <Rule Id="CA2120" Action="Warning" /> <Rule Id="CA2121" Action="Warning" /> <Rule Id="CA2130" Action="Warning" /> <Rule Id="CA2205" Action="Warning" /> <Rule Id="CA2215" Action="Warning" /> <Rule Id="CA2221" Action="Warning" /> <Rule Id="CA2222" Action="Warning" /> <Rule Id="CA2223" Action="Warning" /> <Rule Id="CA2224" Action="Warning" /> <Rule Id="CA2226" Action="Warning" /> <Rule Id="CA2227" Action="Warning" /> <Rule Id="CA2231" Action="Warning" /> <Rule Id="CA2239" Action="Warning" /> </Rules> </RuleSet>
-
Friday, June 29, 2012 10:07 AMModerator
Hi rork,
Glad to receive your reply.
Right click your project in Solution Explorer->Properties->Code Analysis, and select the Enable Code Analysis on Build, and then set the Run this rule set “Microsoft Basic Correctness Rules”, then build your project, check the Output window, whether it has any messages like “Code Analysis Complete…”?
If it has, please check in it again, if it doesn’t has, I double that this rule couldn’t be loaded for some reasons.
Have a nice weekend,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator Thursday, July 05, 2012 2:37 AM

