【发布时间】:2020-09-28 04:16:01
【问题描述】:
我正在尝试学习在个人项目中使用 StyleCop。不是很大,解决方案结构如下:
- 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)
以下是文件夹本身的结构:
- 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
在为 StyleCop 添加文件之前,一切正常。我可以在 Visual Studio 中很好地构建和测试。无论出于何种原因,为 StyleCop 添加文件(可能还有 .editorconfig 文件)似乎在构建时导致了此错误:
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]
据我了解,StyleCop 文件是唯一的分析器文件,它在多个地方被引用。 .editorconfig 是否以某种方式算作另一个分析器文件?如果是这样,我该如何让他们玩得很好?
抑制.editorconfig 中的错误无济于事。单独搜索错误时,我也找不到任何有用的文档。
【问题讨论】:
标签: c# build configuration stylecop analyzer