As the title said, now I have a problem when copy codes from anywhere, and when pasting to my source files (C#/.cs), it will add a namespace automatically, sometimes the namespace is wrong but I don’t know because it was added as unused namespace, but it will have a problem later when I build the project (with Unity) because it can’t find the namespace, Then I have to delete it, it is very annoying.
Question posted in Visual Studio Code
View the official documentation.
View the official documentation.
2
Answers
Try disabling the ‘Enable namespace update when moving files’ option.
In Visual Studio 2022 access the setting via the menu by following…
Tools > Options > Projects and Solutions > General
I believe this is referring to the setting Tools -> Options -> Text Editor -> C# -> Advanced -> Add missing using directives on paste.