Skip to content

.editorconfig ignored when EnableDefaultItems = false #79527

@hopperpl

Description

@hopperpl

Version Used:

VS2022 - Version 17.2.0 Preview 6.0
Roslyn: 4.2.0-4.22220.5

Steps to Reproduce:

I'm not sure if this is a Roslyn issue or a msbuild issue. If the latter, please move it over to dotnet/msbuild

  1. have a .csproj
  2. set EnableDefaultItems to false
  3. within an item group add <Compile Include="Source/**/*.cs" />
  4. use a .editorconfig file at the root of the project (or at the level of folder Source)

Actual Behavior:

  • all settings in .editorconfig are fully ignored
  • all diagnostic/rule settings are ignored, the roslyn analyzer does not suppress as instructed
    (e.g. dotnet_diagnostic.IDE0042.severity = silent)
  • vs2022 does not use this new editor to change settings, it opens .editorconfig as a generic text file

Expected Behavior:

  • .editorconfig should not be removed using EnableDefaultItems, or I need the "counter"-instruction to re-include it

Notes:

<Project>
  <PropertyGroup>
    ...
    <BaseOutputPath>.build\</BaseOutputPath>
    <BaseIntermediateOutputPath>$(BaseOutputPath).intermediate\</BaseIntermediateOutputPath>
    <EnableDefaultItems>false</EnableDefaultItems>
  </PropertyGroup>

  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

  <ItemGroup>
    <Compile Include="Source\**\*.cs" />
  </ItemGroup>
</Project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-NetSDKuntriagedIssues and PRs which have not yet been triaged by a lead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions