dotnet / dotnet/format

[Question] dotnet format utilizes C# 8 features in a project that only supports C# 7.3

Open
#1,484 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

We have a global `.editorconfig` for our team, and most of our projects are using it.

However, one of our utility projects has to utilize `net40` as a target.

However, after running `dotnet format --severity info`, I receive the following errors:

```
Error CS8370: Feature 'recursive patterns' is not available in C# 7.3. Please use language version 8.0 or greater.
Error CS8370: Feature 'using declarations' is not available in C# 7.3. Please use language version 8.0 or greater.
...
```

This error happens as it formats using declarations and pattern matching into the most modern features. I would like to use modern features applicable but still leave my code building afterward. Can I specify c# version in the editorconfig or is it a bug in dotnet format?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.