`dotnet format` emits a warning for unsupported projects even if the project's directory is excluded
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
`dotnet format` emits a warning when the solution contains a project without a language (e.g. `modelproj`) that can't be suppressed even when the folder containing the project is excluded from the analysis.
### To Reproduce
1. Fetch the repro at https://github.com/mm-jhn/repro-20250123/
2. Run `dotnet format --verify-no-changes --exclude "DependencyValidation"`
**Expected**: The project is ignored, no warning is emitted.
**Actual**: _Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings._
When you add `-v diag`, you get this warning:
```
Cannot open project 'C:\Users\[username]\source\repos\repro-20250123\DependencyValidation\DependencyValidation.modelproj' because the file extension '.modelproj' is not associated with a language.
```
### Exceptions (if any)
None, only warnings.
### Further technical details
Visual Studio 17.12.4 on Windows 11
```
.NET SDK:
Version: 9.0.102
Commit: cb83cd4923
Workload version: 9.0.100-manifests.4a54b1a6
MSBuild version: 17.12.18+ed8c6aec5
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.102\
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.1
Architecture: x64
Commit: c8acea2262
.NET SDKs installed:
6.0.428 [C:\Program Files\dotnet\sdk]
8.0.405 [C:\Program Files\dotnet\sdk]
9.0.102 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.