Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS8700 : Multiple analyzer config files cannot be in the same directory, unable to build with seperate .editorconfig files #76833

Open
olejsc opened this issue Jan 21, 2025 · 1 comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@olejsc
Copy link

olejsc commented Jan 21, 2025

Version Used: C#12
Visual studio 2022 17.12.3
Steps to Reproduce:

  1. Create a new console application solution + console application csproj
  2. Add a new class library to solution, lets call it classLib
  3. Right click on console application, generate new editorconfig (intellicode)
  4. Copy the generated .editorconfig from console application proj to the root directory of the classLib
  5. Verify both csproj files have their "own" .editorconfig, by right clicking project in visual studio 2022, and click edit project.
    Ensure both projects HAS this in their .csproj:
  <ItemGroup>
    <EditorConfigFiles Include=".editorconfig" />
  </ItemGroup>
  1. Add a project reference to classLibfrom console application. Create a simple class in classLib and use it to just console.writeline a property in console application.

  2. Compile and run the project.

Observe Error:

Image

A minimal repro, with source-code provided, is ideal. Most compiler/language issues can be distilled into a snippet that can be pasted into sharplab.

Diagnostic Id:
CS8700 Multiple analyzer config files cannot be in the same directory ('C:\Users\XXXX\source\repos\ConsoleApp1\ClassLibrary1').
CS8700 Multiple analyzer config files cannot be in the same directory ('C:\Users\XXXX\source\repos\ConsoleApp1\ConsoleApp1').

If this is a report about a bug in an analyzer, please include the diagnostic ID and message if possible (e.g. "IDE0030: Use coalesce expression").

Expected Behavior:

Expected to be able to compile and run the solution.

Actual Behavior:

CS8700 Diagnostic error prevents compilation
Sample repository zipped:

ConsoleApp1.zip

Note: I've also tried this solution from stackoverflow, to no avail:
https://stackoverflow.com/questions/62274932/cs8700-multiple-analyzer-config-files-cannot-be-in-the-same-directory-but-onl

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 21, 2025
@olejsc
Copy link
Author

olejsc commented Jan 21, 2025

I've also tried ton Visual studio 2022 17.12.4 , to no avail.

I originally encountered this when I had a customer project with this folder structure:

  • Root folder
  • XXX.sln (solution file)
  • WebAPiA
    • .editorconfig
    • WebAPIA.csproj
    • ... misc files for webapi A
    • NOTE: Has a reference to classLibB
  • ClassLibB
    • .editorconfig
    • misc classes
    • no project dependencies

The issue also persist if i add the stylecop nuget to classLibB

Edit, things I've tried:

Appreciate any thoughts on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

1 participant