dotnet format should support custom build configurations
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Is your feature request related to a problem? Please describe.
I have projects that conditionally include some files based on the build configuration. As a simplified example, suppose my .csproj file contains:
```
```
When I run dotnet format the files matching those patterns are not affected. In particular I do not see unused "using" expressions removed for the *Test.cs files while I will see unused using expressions removed for files not matching the patterns.
### Describe the solution you'd like
I am not sure what is possible, but it seems like supporting a --configuration argument should be possible. I would hope to be able to specify the configuration like I would with dotnet build or dotnet test:
> dotnet format --configuration Test
This should cause the project to be built and formatted using the specified build configuration.
### Additional context
I have further problems with JetBrains rider (I haven't tried visual studio) where after I run dotnet format I cannot build or even rebuild from the IDE. I have to do a "dotnet build --configuration Test" to be able to build from the IDE again. I don't know how Visual Studio behaves. I suspect it has something to do with everyone sharing bin and obj directories. Maybe JetBrains Rider could play nicer with the obj and bin directories if that is the case, I can only speculate. It'd be nice though if dotnet format didn't have that side effect.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.