In VS2022 I turned on the very useful feature "Run Code Cleanup profile on Save".
With this option on, every unneeded using statement in code gets removed automatically on save.
Now I would like to create a .cs file that contains a bounch of global using statements and nothing else.
I think that having them in a separate, dedicated file helps keeping project clean.
However, since these global using statements are not used in the .cs file itself, they get removed every time I save the file.
Is there a way to skip cleanup in some circumstances? For example:
- For a specific file
- For global using statements
- When I save with a given keyboard/mouse shortcut (ex. by holding SHIFT or similar when clicking Save)
The first two options would be better because would work also if I run cleanup on the entire project.
UPDATE
I found out that this happens only in NET (8?) projects. global using directives in a NET Framework 4.6.2 project are not removed by code cleanup.
Thank you
