Home > front end >  How do I stop Visual Studio 2022 from automatically changing namespaces and using statements when mo
How do I stop Visual Studio 2022 from automatically changing namespaces and using statements when mo

Time:06-06

VisualStudio 2022 v17.2.3 has suddenly started changing the namespaces of my C# files when I drag them to a different directory. In the process it also deletes/adds/modifies using statements (often deleteriously) and updates every file referencing the moved file. It's changing the namespace to the ProjectName.FolderPath.

Searching Tools > Options has turned up nothing. I've disabled all extensions in case one of them was responsible, but it's had no effect. How can this behaviour be stopped?

CodePudding user response:

To disable this, go to

Tools > Options > Projects and Solutions > General

and untick the box near the bottom next to "Enable namespace updating when moving files". There is a bug in VS2022 that prevents this option being displayed when searched.

  • Related