Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build server fails to load custom code analysis ruleset

We are using Code Analysis on our projects. As part of this we have Code Analysis enabled on the build server allowing for continious checks.

Now we are receiving this error:

CA0063 : * Failed to load rule set file '[name].ruleset' or one of its dependent rule set files.

[name] being a ruleset on our internal network, available for everyone.

Code Analysis runs perfectly fine on each local machine, but not on the build server. How can we fix this issue?

Notes:

  • We use a custom made ruleset
  • We are not using any custom rules (yet)
like image 393
Matthijs Avatar asked Nov 23 '25 08:11

Matthijs


1 Answers

I was having this issue as well. How I solved it was to add my custom ruleset into version control (Git) as a new directory within my project files. We are using Jenkins for our CI, so in my Jenkins.build I then made sure to specify the absolute file path to my ruleset on the Jenkins server, which you can get by looking at your Workspace on Jenkins. For example the path may look like :

e:\Jenkins\workspace\SampleProj-Dev\Rulesets\CustomRules.ruleset

In Jenkins.build file, I added an argument to the msbuild.exe program execution with:

<arg line="/p:RunCodeAnalysis=true;CodeAnalysisRuleSet=e:\Jenkins\workspace\SampleProject-Dev\Rulesets\CustomRules.ruleset"/>

Before I had tried using a relative path but with a build containing many sub-projects, Jenkins tried to append the path onto a changing path. This path was based on the currently building sub-project, resulting in the same error you received.

like image 140
CBrown77 Avatar answered Nov 25 '25 00:11

CBrown77