dotnet / dotnet/project-system

Project file doesn't support .editorconfig

Open
#5,427 0 comments 12 reactions 0 assignees View on GitHub
Feature-Project-File-Editing Needs-CPS-work Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

.editorconfig is an editor concept, and the XML editor that is used for the project file supports it, but other edits made to the project file (eg, changing properties, exclude files, etc.) do not honour its settings, and can in fact revert changes made by .editorconfig support in the editor.

Need to work out how to solve this. Perhaps always using the existing text buffer is enough? Or are changes needed to MSBuilds construction API?

**Repro steps:**

1. Create a .NET Core project
2. Create an .editorconfig file with the following
```
root = true

[*]
charset = utf-16
```
3. Open the project file editor
4. Save

**Expected behavior:**
File is saved in UTF-16

**Actual:**
File is saved in UTF-8 with BOM

It's also illustrated with the following:

1. Create a .NET Core project
2. Create an .editorconfig file with the following
```
root = true

[*]
charset = utf-8
```
3. Open the project file editor
4. Save. NOTE: As expected, the project file is saved as expected, with UTF
6. Exclude Program.cs from the project
7. Save

**Expected:**
Project file is still saved as UTF-8

**Actual:**
Project file is saved as UTF-8 with BOM

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.