sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Feature Request: Allow format to select only one framework in case of multi-target projects

Open zhiyuanliang-ms opened this issue 1 year ago • 2 comments

Migrate #2057 to SDK repo

Is your feature request related to a problem? Please describe.

Why this feature is needed:. When run 'dotnet format' in multi target project, there may cases where format tool can not merges the changes in multi frameworks eg net6, net472 and had to add unhelpful comments like:

/* Unmerged change from project 'xxxx (net6.0)'
 Before:

 After:

 */

Even worse, the unmerged change will not be logged.

See #1634

Describe the solution you'd like

It is great if we can avoid such problems by passing framework option in commandLine , e.g:

dotnet format --framework net472

Additional context

This behavior makes dotnet format unuseable for multi-target projects.

zhiyuanliang-ms avatar Jul 02 '24 10:07 zhiyuanliang-ms

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost avatar Jul 02 '24 10:07 ghost

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost avatar Jul 02 '24 10:07 ghost

Just started bumping into these "Unmerged change from project" errors as well.

As per the original request, if it's possible to specify a TFM to avoid this, that would be way better than having the tool get confused and add a bunch of verbose comments to the code.

jamescrosswell avatar Mar 19 '25 23:03 jamescrosswell