I'm in the process of replacing our in-house TFS2012 server with Azure DevOps (and getting my head around the completely different build stuff), along with upgrading everyone from VS2013 to VS2019. I would like to use the "StyleCop.Analyzers" Roslyn analyser, which I understand will get run during a build, and output any warnings in the build report.
What I'm not sure about is where to put our organisation's .ruleset file, which I would like to use for all of our solutions. It seems silly to have a copy of it with each solution, so I was thinking of putting it in the root of the TFS project ("$/foo/"), and configure all solutions' projects to use this file (project properties Code Analysis tab). I'm assuming the path would be saved in the project file as a relative path, but how will the build handle it, because the file is not in the folder hierarchy of the solution being built? I assume it wouldn't be present.
Alternatively I suppose I could keep the ruleset file on a network share somewhere. Thoughts on best approach?
You can add it to the source control and if you are using a root public folder to store ruleset file, you just need to make sure map it to build agent during each build pipeline.
After include the mapping in get source step, even build different solution, it will also download the file from server side to build agent.
Create shared folder is also ok if can be accessible from build agent machine. You could also use copy files task to copy the files to the path you are referring during the build.
As for how the build agent handle Code Analysis ruleset, please kindly refer jessehouwing's detail explanation in this question: TFS Build ignores configured Code Analysis ruleset