I really like new productivity tool Sync namespaces in Visual Studio 2022 but sometimes there are rare cases when I need to exclude some file or folder when I synchronize namespaces.
Example 1
By convention, DI extensions should be created in the Microsoft.Extensions.DependencyInjection
namespace. From the ASP.NET Core Guide :
We recommended that apps follow the naming convention of creating extension methods in the Microsoft.Extensions.DependencyInjection namespace. Creating extension methods in the Microsoft.Extensions.DependencyInjection namespace:
- Encapsulates groups of service registrations.
- Provides convenient IntelliSense access to the service.
Example 2
I have .NET Standard 2.0 project where I want to use constructor-based record declaration and according to this solution Testing C# 9.0 in VS2019 - CS0518 IsExternalInit is not defined or imported ... How do I define/import it? I'm adding the following file to my project:
namespace System.Runtime.CompilerServices;
internal static class IsExternalInit { }
Obviously after doing 'Sync namespaces' this file will be changed and the trick will not work.