Of late, I am tending to paste a lot more code into existing C# source files due to AI. Visual Studio 2022 introduced a feature that after code is pasted, Visual Studio will add any missing using statements to the source file. When working with CSV-related code, without my knowledge, Visual Studio adds the following to the top of a source file:
using Microsoft.VisualBasic.FileIO;
I do not want tools such as Visual Studio 2022, Copilot, or ChatGPT to write code without my knowledge or consent.
To disable the automatic addition of using directives after pasting in Visual Studio 2022 or later:
- From the Tools menu, select Options…
- Navigate to Text Editor → C# → Advanced
- Uncheck Add missing using directives on paste
I have disabled this feature multiple times. It seems to re-enable. Proof of Skynet?