Your original XPath expression looks good to me. Except that, given the != operator, it raises issues only when the content of the Private tag is notFalse. I set up the following expression and it raised an issue on your code example:
just to be clear, are you using the Sonar Scanner for MSBuild?
are the XML files you want to be analysed referenced by the projects you are building, and if so which item groups are they in? (e.g. Compile, Content etc)
When you run the End step of the Scanner for MSBuild it generates a sonar-project.properties file that lists all of the files that will be analysed. The file will be in the .sonarqube\out directory. Check that your XML files are included.
Ok, so the Scanner for MSBuild is passing the correct configuration to the command line scanner that is being executed in the end step.
I’m not familiar with custom XPath rules so I can’t be of much more help. Some general suggestions: check that the rule is enabled in the QP, check that the expected QP is being used during the analysis, and check the console output of the end step for any warnings or errors.
Anyone who can help here…We have also tried to write a utility from Java to scan xml files but how to apply that on the C# project? Doing Sonar Scanner or MSbuild the rules are still not applied.