I'm trying to learn to use StyleCop on a personal project. It's not a very big one, and the solution structure is below:
- MySolution (2 of 2 projects)
- Solution Items
- .editorconfig
- .gitignore
- CODEOWNERS
- my-pipeline-workflow.yml
- README.md
- stylecop.json
- MyMainProject
- Dependencies
- .editorconfig (pointer Solution Items copy)
- OneOfManyCsFiles.cs
- stylecop.json (pointer Solution Items copy)
- MyTestProject
- Dependencies
- .editorconfig (pointer Solution Items copy)
- OneOfManyTestCsFiles.cs
- stylecop.json (pointer Solution Items copy)
And here is how the folders themselves are structured:
- RepoFolder
- .github
- workflows
- my-pipeline-workflow.yml
- src
- MyMainProject.csproj
- OneOfManyCsFiles.cs
- test
- MyTestProject.csproj
- OneOfManyTestCsFiles.cs
- .editorconfig
- .gitignore
- CODEOWNERS
- MySolution.sln
- README.md
- stylecop.json
Everything worked prior to adding the file for StyleCop. I could build and test just fine in Visual Studio. For whatever reason, adding the file for StyleCop (and maybe the .editorconfig
file) seems to have caused this error on build:
CSC: error CS8700: Multiple analyzer config files cannot be in the same directory ('/home/runner/work/MySolution/MySolution').
[/home/runner/work/MySolution/MySolution/src/MyMainProject.csproj]
As far as I understand, the StyleCop file is the only analyzer file and it's referenced in multiple places. Does the .editorconfig
somehow count as another analyzer file? If so, how do I get them to play nice?
Suppressing the error in .editorconfig
does nothing. I haven't been able to find any helpful documentation when searching the error alone either.
.editorconfig
files nested inside subfolders, simply by not specifyingroot = true
option (reference) – Enroll