skip to Main Content

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.

2

Answers


  1. 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

    Login or Signup to reply.
  2. I believe this is referring to the setting Tools -> Options -> Text Editor -> C# -> Advanced -> Add missing using directives on paste.

    Showing the checkbox for Add missing using directives on paste

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search